|
@@ -51,36 +51,42 @@ class BaseCronControl
|
|
|
if ($_break) {
|
|
|
break;
|
|
|
}
|
|
|
- $model_order->beginTransaction();
|
|
|
- $goods_list = $model_order->getOrderGoodsList(array('commis_rate' => 200), 'rec_id,goods_id,store_id,gc_id', 100, null, '');
|
|
|
- if (!empty($goods_list))
|
|
|
+
|
|
|
+ try
|
|
|
{
|
|
|
- //$commis_rate_list : store_id => array(gc_id => commis_rate)
|
|
|
- $commis_rate_list = $store_bind_class->getStoreGcidCommisRateList($goods_list);
|
|
|
- //更新订单商品佣金值
|
|
|
- foreach ($goods_list as $v) {
|
|
|
- //如果未查到店铺或分类ID,则佣金置0
|
|
|
- if (!isset($commis_rate_list[$v['store_id']][$v['gc_id']])) {
|
|
|
- $commis_rate = 0;
|
|
|
- } else {
|
|
|
- $commis_rate = $commis_rate_list[$v['store_id']][$v['gc_id']];
|
|
|
- }
|
|
|
- $update = $model_order->editOrderGoods(array('commis_rate' => $commis_rate),array('rec_id' => $v['rec_id']));
|
|
|
- if (!$update) {
|
|
|
- $this->log('更新实物订单商品佣金值失败'); $_break = true; break;
|
|
|
+ $trans = new trans_wapper($model_order,__METHOD__);
|
|
|
+ $goods_list = $model_order->getOrderGoodsList(array('commis_rate' => 200), 'rec_id,goods_id,store_id,gc_id', 100, null, '');
|
|
|
+ if (!empty($goods_list))
|
|
|
+ {
|
|
|
+ //$commis_rate_list : store_id => array(gc_id => commis_rate)
|
|
|
+ $commis_rate_list = $store_bind_class->getStoreGcidCommisRateList($goods_list);
|
|
|
+ //更新订单商品佣金值
|
|
|
+ foreach ($goods_list as $v) {
|
|
|
+ //如果未查到店铺或分类ID,则佣金置0
|
|
|
+ if (!isset($commis_rate_list[$v['store_id']][$v['gc_id']])) {
|
|
|
+ $commis_rate = 0;
|
|
|
+ } else {
|
|
|
+ $commis_rate = $commis_rate_list[$v['store_id']][$v['gc_id']];
|
|
|
+ }
|
|
|
+ $update = $model_order->editOrderGoods(array('commis_rate' => $commis_rate),array('rec_id' => $v['rec_id']));
|
|
|
+ if (!$update) {
|
|
|
+ $this->log('更新实物订单商品佣金值失败'); $_break = true; break;
|
|
|
+ }
|
|
|
+ $update = $model_refund_return->editRefundReturn(array('store_id'=>$v['store_id'],'goods_id'=>$v['goods_id']),array('commis_rate' => $commis_rate));
|
|
|
+ if (!$update) {
|
|
|
+ $this->log('更新实物订单退款佣金值失败'); $_break = true; break;
|
|
|
+ }
|
|
|
}
|
|
|
- $update = $model_refund_return->editRefundReturn(array('store_id'=>$v['store_id'],'goods_id'=>$v['goods_id']),array('commis_rate' => $commis_rate));
|
|
|
- if (!$update) {
|
|
|
- $this->log('更新实物订单退款佣金值失败'); $_break = true; break;
|
|
|
- }
|
|
|
+ } else {
|
|
|
+ break;
|
|
|
}
|
|
|
- } else {
|
|
|
- break;
|
|
|
+ $trans->commit();
|
|
|
+ }
|
|
|
+ catch (Exception $ex) {
|
|
|
+ $trans->rollback();
|
|
|
}
|
|
|
- $model_order->commit();
|
|
|
}
|
|
|
- $model_order->commit();
|
|
|
-
|
|
|
+
|
|
|
//虚拟订单,每次最多处理50W个商品佣金
|
|
|
$_break = false;
|
|
|
$model_order = Model('vr_order');
|
|
@@ -91,40 +97,47 @@ class BaseCronControl
|
|
|
if ($_break) {
|
|
|
break;
|
|
|
}
|
|
|
- $model_order->beginTransaction();
|
|
|
- $goods_list = $model_order->getOrderList(array('commis_rate' => 200),'', 'order_id,store_id,gc_id', '',100);
|
|
|
- if (!empty($goods_list))
|
|
|
+ try
|
|
|
{
|
|
|
- //$commis_rate_list : store_id => array(gc_id => commis_rate)
|
|
|
- $commis_rate_list = $store_bind_class->getStoreGcidCommisRateList($goods_list);
|
|
|
- //更新订单商品佣金值
|
|
|
- foreach ($goods_list as $v)
|
|
|
+ $trans = new trans_wapper($model_order,__METHOD__);
|
|
|
+ $goods_list = $model_order->getOrderList(array('commis_rate' => 200),'', 'order_id,store_id,gc_id', '',100);
|
|
|
+ if (!empty($goods_list))
|
|
|
{
|
|
|
- //如果未查到店铺或分类ID,则佣金置0
|
|
|
- if (!isset($commis_rate_list[$v['store_id']][$v['gc_id']])) {
|
|
|
- $commis_rate = 0;
|
|
|
- } else {
|
|
|
- $commis_rate = $commis_rate_list[$v['store_id']][$v['gc_id']];
|
|
|
- }
|
|
|
- $update = $model_order->editOrder(array('commis_rate' => $commis_rate),array('order_id' => $v['order_id']));
|
|
|
- if (!$update) {
|
|
|
- $this->log('更新虚拟订单商品佣金值失败'); $_break = true; break;
|
|
|
- }
|
|
|
- $update = $model_order->editOrderCode(array('commis_rate' => $commis_rate),array('order_id' => $v['order_id']));
|
|
|
- if (!$update) {
|
|
|
- $this->log('更新虚拟订单兑换码佣金值失败'); $_break = true; break;
|
|
|
- }
|
|
|
- $update = $model_vr_refund->editRefund(array('order_id' => $v['order_id']),array('commis_rate' => $commis_rate));
|
|
|
- if (!$update) {
|
|
|
- $this->log('更新虚拟订单商品退款佣金值失败'); $_break = true; break;
|
|
|
+ //$commis_rate_list : store_id => array(gc_id => commis_rate)
|
|
|
+ $commis_rate_list = $store_bind_class->getStoreGcidCommisRateList($goods_list);
|
|
|
+ //更新订单商品佣金值
|
|
|
+ foreach ($goods_list as $v)
|
|
|
+ {
|
|
|
+ //如果未查到店铺或分类ID,则佣金置0
|
|
|
+ if (!isset($commis_rate_list[$v['store_id']][$v['gc_id']])) {
|
|
|
+ $commis_rate = 0;
|
|
|
+ } else {
|
|
|
+ $commis_rate = $commis_rate_list[$v['store_id']][$v['gc_id']];
|
|
|
+ }
|
|
|
+ $update = $model_order->editOrder(array('commis_rate' => $commis_rate),array('order_id' => $v['order_id']));
|
|
|
+ if (!$update) {
|
|
|
+ $this->log('更新虚拟订单商品佣金值失败'); $_break = true; break;
|
|
|
+ }
|
|
|
+ $update = $model_order->editOrderCode(array('commis_rate' => $commis_rate),array('order_id' => $v['order_id']));
|
|
|
+ if (!$update) {
|
|
|
+ $this->log('更新虚拟订单兑换码佣金值失败'); $_break = true; break;
|
|
|
+ }
|
|
|
+ $update = $model_vr_refund->editRefund(array('order_id' => $v['order_id']),array('commis_rate' => $commis_rate));
|
|
|
+ if (!$update) {
|
|
|
+ $this->log('更新虚拟订单商品退款佣金值失败'); $_break = true; break;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
+ else {
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ $trans->commit();
|
|
|
+
|
|
|
}
|
|
|
- else {
|
|
|
- break;
|
|
|
+ catch (Exception $ex)
|
|
|
+ {
|
|
|
+ $trans->rollback();
|
|
|
}
|
|
|
- $model_order->commit();
|
|
|
}
|
|
|
- $model_order->commit();
|
|
|
}
|
|
|
}
|