作者 chencheng
@@ -126,10 +126,10 @@ class Business extends Api @@ -126,10 +126,10 @@ class Business extends Api
126 $keyfield=$this->postParam['keyfield']; 126 $keyfield=$this->postParam['keyfield'];
127 $page = $this->request->post('page', 1); 127 $page = $this->request->post('page', 1);
128 $total = $this->request->post('total', 10); 128 $total = $this->request->post('total', 10);
129 - $where="a.verification_store_id=".$this->store_id; 129 + $where['a.verification_store_id'] =['=', $this->store_id];
130 if($keyfield){ 130 if($keyfield){
131 - $where.=" and (c.receive_no like %{$keyfield}% or e.mobile like %{$keyfield}%)";  
132 - 131 + $where['c.receive_no'] =['like', '%' . $keyfield . '%'];
  132 + $where['e.mobile'] = ['like', '%' . $keyfield . '%'];
133 } 133 }
134 $field = "a.id,a.createtime,b.name,d.name as coupon_name,c.type"; 134 $field = "a.id,a.createtime,b.name,d.name as coupon_name,c.type";
135 $cancel=Db::name('verification_cancel') 135 $cancel=Db::name('verification_cancel')
@@ -139,7 +139,8 @@ class Business extends Api @@ -139,7 +139,8 @@ class Business extends Api
139 ->join('verification_coupon d','c.verification_coupon_id=d.id') 139 ->join('verification_coupon d','c.verification_coupon_id=d.id')
140 ->join('user e','c.user_id=e.id') 140 ->join('user e','c.user_id=e.id')
141 ->where($where) 141 ->where($where)
142 - ->fetchSql()->select(); 142 + ->paginate($total, false, ['page' => $page])
  143 + ->toArray();
143 $this->success('查询成功',$cancel); 144 $this->success('查询成功',$cancel);
144 145
145 } 146 }
@@ -159,6 +160,8 @@ class Business extends Api @@ -159,6 +160,8 @@ class Business extends Api
159 * 6、订单查询 160 * 6、订单查询
160 */ 161 */
161 public function selectorder(){ 162 public function selectorder(){
  163 + $keyfield=$this->postParam['keyfield'];
  164 +
162 $page = $this->request->post('page', 1); 165 $page = $this->request->post('page', 1);
163 $total = $this->request->post('total', 10); 166 $total = $this->request->post('total', 10);
164 $where["a.verification_store_id"] = ["=", $this->store_id]; 167 $where["a.verification_store_id"] = ["=", $this->store_id];
@@ -11,7 +11,7 @@ use think\Exception; @@ -11,7 +11,7 @@ use think\Exception;
11 */ 11 */
12 class Client extends Api 12 class Client extends Api
13 { 13 {
14 - protected $noNeedLogin = ['*']; 14 + protected $noNeedLogin = [''];
15 protected $noNeedRight = ['*']; 15 protected $noNeedRight = ['*'];
16 protected $postParam; 16 protected $postParam;
17 protected $store_id; 17 protected $store_id;
@@ -38,16 +38,16 @@ class Client extends Api @@ -38,16 +38,16 @@ class Client extends Api
38 } 38 }
39 $this->store = $store; 39 $this->store = $store;
40 if (empty($this->auth->id)) { 40 if (empty($this->auth->id)) {
  41 + $this->error("非法操作,用户信息为空");
41 42
42 - return;  
43 - } 43 + }
44 44
45 } 45 }
46 /** 46 /**
47 * 1、获取活动 47 * 1、获取活动
48 */ 48 */
49 public function getactivity(){ 49 public function getactivity(){
50 - 50 + $this->success('123',$this->auth->id);
51 //根据门店查询活动 51 //根据门店查询活动
52 $time=time(); 52 $time=time();
53 $where["closetime"] = [">", $time]; 53 $where["closetime"] = [">", $time];
@@ -163,8 +163,8 @@ class Wechat extends Api @@ -163,8 +163,8 @@ class Wechat extends Api
163 if(empty(request()->param('code'))){ 163 if(empty(request()->param('code'))){
164 return $this->error('非法操作'); 164 return $this->error('非法操作');
165 } 165 }
166 -  
167 - 166 +
  167 +
168 try{ 168 try{
169 $app = WehcatModule::getInstance()->initWechat(); 169 $app = WehcatModule::getInstance()->initWechat();
170 $oauth = $app->oauth; 170 $oauth = $app->oauth;
@@ -201,7 +201,7 @@ class Wechat extends Api @@ -201,7 +201,7 @@ class Wechat extends Api
201 if($user_id !=0){ 201 if($user_id !=0){
202 202
203 $data['token'] = $this->auth->getToken(); 203 $data['token'] = $this->auth->getToken();
204 - $data['user_info'] = $user; 204 + $data['user_info'] =$this->auth->getUserinfo();
205 $this->success('完成',$data); 205 $this->success('完成',$data);
206 }else{ 206 }else{
207 $this->error('code处理失败'); 207 $this->error('code处理失败');
@@ -222,7 +222,7 @@ class Wechat extends Api @@ -222,7 +222,7 @@ class Wechat extends Api
222 return $this->error('请求错误'); 222 return $this->error('请求错误');
223 } 223 }
224 $my_user_id = $this->auth->id; 224 $my_user_id = $this->auth->id;
225 - 225 +
226 if(empty($my_user_id)){return $this->error('用户信息错误');} 226 if(empty($my_user_id)){return $this->error('用户信息错误');}
227 if(empty($param['store_id'])){return $this->error('门店信息错误');} 227 if(empty($param['store_id'])){return $this->error('门店信息错误');}
228 //记录门店浏览统计 228 //记录门店浏览统计
@@ -264,7 +264,7 @@ class Wechat extends Api @@ -264,7 +264,7 @@ class Wechat extends Api
264 $data['user_id'] = $user_id; 264 $data['user_id'] = $user_id;
265 $data['createtime'] = time(); 265 $data['createtime'] = time();
266 Db::name('verification_store_user_record')->insert($data); 266 Db::name('verification_store_user_record')->insert($data);
267 - } 267 + }
268 268
269 269
270 /* 270 /*
@@ -355,7 +355,7 @@ class Wechat extends Api @@ -355,7 +355,7 @@ class Wechat extends Api
355 * 4. 上级的上级 是普通人,则直接获得某个门店的所有礼品券 355 * 4. 上级的上级 是普通人,则直接获得某个门店的所有礼品券
356 * A -> B -> C 下单 356 * A -> B -> C 下单
357 * $order_info 支付成功后的订单信息 357 * $order_info 支付成功后的订单信息
358 - */ 358 + */
359 359
360 public function sales_distribution($order_info){ 360 public function sales_distribution($order_info){
361 $w['id'] = $order_info['user_id']; 361 $w['id'] = $order_info['user_id'];
@@ -368,7 +368,7 @@ class Wechat extends Api @@ -368,7 +368,7 @@ class Wechat extends Api
368 $w1['id'] = $myInfo['pid']; 368 $w1['id'] = $myInfo['pid'];
369 $myInfoP = Db::name('user')->where($w1)->find(); 369 $myInfoP = Db::name('user')->where($w1)->find();
370 $this->getParent($myInfoP['id'],$order_info['verification_store_id'],$order_info['id']); 370 $this->getParent($myInfoP['id'],$order_info['verification_store_id'],$order_info['id']);
371 - 371 +
372 } 372 }
373 } 373 }
374 374
@@ -444,14 +444,14 @@ class Wechat extends Api @@ -444,14 +444,14 @@ class Wechat extends Api
444 $verification_order = Db::name('verification_order')->where(['id'=>$order_id])->find(); 444 $verification_order = Db::name('verification_order')->where(['id'=>$order_id])->find();
445 $app = WehcatModule::getInstance()->initWechatPay(); 445 $app = WehcatModule::getInstance()->initWechatPay();
446 $result = $app->redpack->sendNormal([ 446 $result = $app->redpack->sendNormal([
447 - 447 +
448 'mch_billno' => '168532907259455', 448 'mch_billno' => '168532907259455',
449 'send_name' => '测试红包', 449 'send_name' => '测试红包',
450 're_openid' => 'o5OQw6PPEGaHqIjAir7gqeDV5MzQ', 450 're_openid' => 'o5OQw6PPEGaHqIjAir7gqeDV5MzQ',
451 'total_num' => 1, //固定为1,可不传 451 'total_num' => 1, //固定为1,可不传
452 'total_amount' => 100, //单位为分,不小于100 452 'total_amount' => 100, //单位为分,不小于100
453 'wishing' => '祝福语', 453 'wishing' => '祝福语',
454 - 454 +
455 'act_name' => '测试活动', 455 'act_name' => '测试活动',
456 'remark' => '测试备注', 456 'remark' => '测试备注',
457 ]); 457 ]);