songxingwei %!s(int64=2) %!d(string=hai) anos
pai
achega
ecb1161753

+ 0 - 13
application/order/controller/SecondaryOrder.php

@@ -62,19 +62,6 @@ class SecondaryOrder extends Controller
         $this->fetch('detail');
     }
 
-    /**
-     * 订单发货
-     * @auth true
-     * @menu true
-     */
-
-    public function deliver()
-    {
-        $this->title = '发货';
-        $this->express_company = Db::table('store_express_company')->field('id,express_title')->select();
-        $this->_form($this->table,'deliver');
-    }
-
 
 
     /**

+ 48 - 0
application/store/controller/CollectionBonus.php

@@ -100,6 +100,54 @@ class CollectionBonus extends Controller
 
 
     /**
+     * 单个分红
+     * @auth true
+     * @menu true
+     * @throws \think\Exception
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     * @throws \think\exception\PDOException
+     */
+    public function settlement()
+    {
+        $id = $this->request->get('id');
+        echo $id;die;
+        Db::name('store_member_bonus_info')
+            ->alias('a')
+            ->leftJoin('store_member b','a.mid=b.id')
+            ->field('a.*,b.phone,b.name,b.yeepay_wallet,b.walletUserNo')
+            ->where('a.bonus_id',$id)
+            ->where('a.status',0)
+            ->chunk(1,function ($list){
+                $yeep = new Yeepay();
+                foreach ($list as &$v){
+                    $res = false;
+                    $fash = Db::name('store_fashionable')
+                        ->where('status',1)
+                        ->where('remaining_amount','egt',$v['price'])
+                        ->find();
+                    if (!$fash){
+                        break;
+                    }else{
+                        $result = json_decode($fash['pay_return'],true);
+                        $res = $yeep->subAccount($result['orderId'],$result['uniqueOrderNo'],$v['price'],$v['walletUserNo']);
+                        $da = [
+                            'status'=>0,
+                            'subaccount_at'=>date('Y-m-d H:i:s'),
+                            'subaccount_return'=>json_encode($res,true)
+                        ];
+                        if ($res && $res['state']=='SUCCESS' && $res['result']['code']=='OPR00000'){
+                            $da['status'] = 1;
+                        }
+                    }
+                }
+            },'a.id','asc');
+        $this->success('请求成功,分账中..');
+    }
+
+
+    /**
      * 分红明细
      * @auth true
      * @menu true