作者 chencheng
... ... @@ -126,10 +126,10 @@ class Business extends Api
$keyfield=$this->postParam['keyfield'];
$page = $this->request->post('page', 1);
$total = $this->request->post('total', 10);
$where="a.verification_store_id=".$this->store_id;
$where['a.verification_store_id'] =['=', $this->store_id];
if($keyfield){
$where.=" and (c.receive_no like %{$keyfield}% or e.mobile like %{$keyfield}%)";
$where['c.receive_no'] =['like', '%' . $keyfield . '%'];
$where['e.mobile'] = ['like', '%' . $keyfield . '%'];
}
$field = "a.id,a.createtime,b.name,d.name as coupon_name,c.type";
$cancel=Db::name('verification_cancel')
... ... @@ -139,7 +139,8 @@ class Business extends Api
->join('verification_coupon d','c.verification_coupon_id=d.id')
->join('user e','c.user_id=e.id')
->where($where)
->fetchSql()->select();
->paginate($total, false, ['page' => $page])
->toArray();
$this->success('查询成功',$cancel);
}
... ... @@ -159,6 +160,8 @@ class Business extends Api
* 6、订单查询
*/
public function selectorder(){
$keyfield=$this->postParam['keyfield'];
$page = $this->request->post('page', 1);
$total = $this->request->post('total', 10);
$where["a.verification_store_id"] = ["=", $this->store_id];
... ...
... ... @@ -11,7 +11,7 @@ use think\Exception;
*/
class Client extends Api
{
protected $noNeedLogin = ['*'];
protected $noNeedLogin = [''];
protected $noNeedRight = ['*'];
protected $postParam;
protected $store_id;
... ... @@ -38,16 +38,16 @@ class Client extends Api
}
$this->store = $store;
if (empty($this->auth->id)) {
$this->error("非法操作,用户信息为空");
return;
}
}
}
/**
* 1、获取活动
*/
public function getactivity(){
$this->success('123',$this->auth->id);
//根据门店查询活动
$time=time();
$where["closetime"] = [">", $time];
... ...
... ... @@ -163,8 +163,8 @@ class Wechat extends Api
if(empty(request()->param('code'))){
return $this->error('非法操作');
}
try{
$app = WehcatModule::getInstance()->initWechat();
$oauth = $app->oauth;
... ... @@ -201,7 +201,7 @@ class Wechat extends Api
if($user_id !=0){
$data['token'] = $this->auth->getToken();
$data['user_info'] = $user;
$data['user_info'] =$this->auth->getUserinfo();
$this->success('完成',$data);
}else{
$this->error('code处理失败');
... ... @@ -222,7 +222,7 @@ class Wechat extends Api
return $this->error('请求错误');
}
$my_user_id = $this->auth->id;
if(empty($my_user_id)){return $this->error('用户信息错误');}
if(empty($param['store_id'])){return $this->error('门店信息错误');}
//记录门店浏览统计
... ... @@ -264,7 +264,7 @@ class Wechat extends Api
$data['user_id'] = $user_id;
$data['createtime'] = time();
Db::name('verification_store_user_record')->insert($data);
}
}
/*
... ... @@ -355,7 +355,7 @@ class Wechat extends Api
* 4. 上级的上级 是普通人,则直接获得某个门店的所有礼品券
* A -> B -> C 下单
* $order_info 支付成功后的订单信息
*/
*/
public function sales_distribution($order_info){
$w['id'] = $order_info['user_id'];
... ... @@ -368,7 +368,7 @@ class Wechat extends Api
$w1['id'] = $myInfo['pid'];
$myInfoP = Db::name('user')->where($w1)->find();
$this->getParent($myInfoP['id'],$order_info['verification_store_id'],$order_info['id']);
}
}
... ... @@ -444,14 +444,14 @@ class Wechat extends Api
$verification_order = Db::name('verification_order')->where(['id'=>$order_id])->find();
$app = WehcatModule::getInstance()->initWechatPay();
$result = $app->redpack->sendNormal([
'mch_billno' => '168532907259455',
'send_name' => '测试红包',
're_openid' => 'o5OQw6PPEGaHqIjAir7gqeDV5MzQ',
'total_num' => 1, //固定为1,可不传
'total_amount' => 100, //单位为分,不小于100
'wishing' => '祝福语',
'act_name' => '测试活动',
'remark' => '测试备注',
]);
... ...