|
@@ -25,13 +25,16 @@ class Plantask extends Controller
|
|
|
'have_paid' => ['gt',0],
|
|
|
'paidtasktime' => 0,
|
|
|
];
|
|
|
- $order_list = Db::name('unishop_order')->where($map)->order('id asc')->limit(10)->select();
|
|
|
+
|
|
|
+ Db::startTrans();
|
|
|
+ $order_list = Db::name('unishop_order')->where($map)->order('id asc')->limit(10)->lock(true)->select();
|
|
|
if(empty($order_list)){
|
|
|
echo '没有数据';
|
|
|
+ Db::rollback();
|
|
|
exit;
|
|
|
}
|
|
|
|
|
|
- Db::startTrans();
|
|
|
+
|
|
|
$walletmodel = new Wallet();
|
|
|
|
|
|
foreach($order_list as $key => $order){
|
|
@@ -40,7 +43,7 @@ class Plantask extends Controller
|
|
|
if($order['order_benjin'] > 0){
|
|
|
|
|
|
$remark = '本金:'.$order['order_benjin'];
|
|
|
- $rs_wallet = model('wallet')->lockChangeAccountRemain($order['user_id'],'score',$order['order_benjin'],5,$remark,'unishop_order',$order['id'],$order['user_id']);
|
|
|
+ $rs_wallet = $walletmodel->lockChangeAccountRemain($order['user_id'],'score',$order['order_benjin'],5,$remark,'unishop_order',$order['id'],$order['user_id']);
|
|
|
if($rs_wallet['status'] === false){
|
|
|
echo $rs_wallet['msg'];
|
|
|
Db::rollback();
|
|
@@ -116,7 +119,7 @@ class Plantask extends Controller
|
|
|
}*/
|
|
|
|
|
|
$tendays_ago = jiesuan_tendays_ago();
|
|
|
-// echo $tendays_ago;exit;
|
|
|
+
|
|
|
//
|
|
|
Db::startTrans();
|
|
|
$order_map = [
|
|
@@ -124,13 +127,14 @@ class Plantask extends Controller
|
|
|
'have_paid' => ['lt',$tendays_ago],
|
|
|
'jiesuantime' => 0,
|
|
|
];
|
|
|
- $order = Db::name('unishop_order')->where($order_map)->where('have_paid','gt',0)->order('id asc')->lock(true)->find();
|
|
|
- if(empty($order)){
|
|
|
+ $order_list = Db::name('unishop_order')->where($order_map)->where('have_paid','gt',0)->order('id asc')->lock(true)->limit(10)->select();
|
|
|
+ if(empty($order_list)){
|
|
|
echo '没有数据';
|
|
|
Db::rollback();
|
|
|
exit;
|
|
|
}
|
|
|
-// dump($order);
|
|
|
+
|
|
|
+ foreach($order_list as $key => $order){
|
|
|
|
|
|
//买家得到收益,两个数据同步加
|
|
|
if($order['order_shouyi'] > 0){
|
|
@@ -170,10 +174,14 @@ class Plantask extends Controller
|
|
|
exit;
|
|
|
}
|
|
|
|
|
|
- Db::commit();
|
|
|
+ //循环结束
|
|
|
echo '完成'.$order['id'];
|
|
|
}
|
|
|
|
|
|
+ Db::commit();
|
|
|
+ echo '成功'.count($order_list);
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
|
|
|
}
|