作者 chencheng

0531-2

@@ -150,6 +150,7 @@ class Client extends Api @@ -150,6 +150,7 @@ class Client extends Api
150 ->where($where) 150 ->where($where)
151 ->paginate($total, false, ['page' => $page]) 151 ->paginate($total, false, ['page' => $page])
152 ->toArray(); 152 ->toArray();
  153 + return $this->success($row);
153 } 154 }
154 155
155 /** 156 /**
@@ -370,9 +370,14 @@ class Wechat extends Api @@ -370,9 +370,14 @@ class Wechat extends Api
370 * $order_info 支付成功后的订单信息 370 * $order_info 支付成功后的订单信息
371 */ 371 */
372 372
373 - public function sales_distribution($order_info){ 373 + public function sales_distribution($order_info=[]){
  374 + //测试
  375 + $order_info = Db::name('verification_order')->where("id='14'")->find();
  376 +
  377 + if(empty($order_info)){ return $this->error('订单信息不存在');}
374 $w['id'] = $order_info['user_id']; 378 $w['id'] = $order_info['user_id'];
375 $myInfo = Db::name('user')->where($w)->find(); 379 $myInfo = Db::name('user')->where($w)->find();
  380 +
376 //是否与上级 381 //是否与上级
377 if(!empty($myInfo['pid'])){ 382 if(!empty($myInfo['pid'])){
378 //上级 383 //上级
@@ -381,11 +386,14 @@ class Wechat extends Api @@ -381,11 +386,14 @@ class Wechat extends Api
381 }catch(\Exception $e){ 386 }catch(\Exception $e){
382 Common::put_file_log('上级-分销异常',json_encode($e->getMessage()), 'sales_distribution', __CLASS__ . __FUNCTION__ . __LINE__); 387 Common::put_file_log('上级-分销异常',json_encode($e->getMessage()), 'sales_distribution', __CLASS__ . __FUNCTION__ . __LINE__);
383 } 388 }
  389 + die;
384 //上级的上级 390 //上级的上级
385 try{ 391 try{
386 $w1['id'] = $myInfo['pid']; 392 $w1['id'] = $myInfo['pid'];
387 $myInfoP = Db::name('user')->where($w1)->find(); 393 $myInfoP = Db::name('user')->where($w1)->find();
388 - $this->getParent($myInfoP['id'],$order_info['verification_store_id'],$order_info['id']); 394 + if(!empty($myInfoP['pid'])){
  395 + $this->getParent($myInfoP['id'],$order_info['verification_store_id'],$order_info['id']);
  396 + }
389 }catch(\Exception $e){ 397 }catch(\Exception $e){
390 Common::put_file_log('上级的上级-分销异常',json_encode($e->getMessage()), 'sales_distribution', __CLASS__ . __FUNCTION__ . __LINE__); 398 Common::put_file_log('上级的上级-分销异常',json_encode($e->getMessage()), 'sales_distribution', __CLASS__ . __FUNCTION__ . __LINE__);
391 } 399 }