123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- <?php
- namespace app\store\controller;
- use library\Controller;
- use think\Db;
- /**
- * 订单转换
- * Class Order
- * @package app\store\controller
- */
- class OrderShift extends Controller
- {
- protected $table = "OrderShift";
- /**
- * 订单列表
- * @auth true
- * @menu true
- */
- public function index()
- {
- $this->title = '订单转换列表';
- $this->sh_status_desc = ['待审核','审核通过','审核拒绝'];
- $query = $this->_query($this->table);
- if($this->request->request('phone')) $where[]= ['m.phone','like','%'.$this->request->request('phone').'%'];
- if($this->request->request('order_no')) $where[]= ['o.order_no','like','%'.trim($this->request->request('order_no')).'%'];
- $this->sh_status = $this->request->request('sh_status',-1);
- if($this->sh_status > -1 ) $where[]= ['o.sh_status','=',$this->request->request('sh_status')];
- $query->alias('o')
- ->field('o.* ,m.headimg,m.name,m.phone')
- ->join('store_member m',' m.id = o.uid ','LEFT');
- if(!empty($where)) $query->where($where);
- $query ->order('o.sh_status asc ,o.id desc')->page();
- }
- /**
- * 订单审核
- * @auth true
- * @menu true
- */
- public function aduit()
- {
- $this->title = '订单审核';
- $audit_desc = Db::table('audit_desc')->where('is_deleted',0)->where('status',1)
- ->order('sort desc ,id desc')
- ->select();
- $audit_set = [];
- $audit_set[0]='请选择';
- foreach ($audit_desc as $dv) {
- $audit_set[$dv['id']]=$dv['title'];
- }
- $this->audit_set = $audit_set;
- $this->_form($this->table, 'form');
- }
- protected function _form_filter(&$data)
- {
- // 查看
- if($this->request->isGet() && $this->request->action() == 'aduit')
- {
- $this->user = Db::table('store_member')
- ->field('headimg,name,phone')
- ->find($data['uid']);
- }
- // 积分赠送integral_info
- if($this->request->isPost() && $this->request->action() == 'aduit') {
- $ck = Db::table('order_shift')->find($data['id']);
- if($ck['sh_status'] != 1 && $data['sh_status'] == 1 && $data['integral'] > 0 && $data['uid']) {
- update_user_integral($data['uid'],$data['integral'],4,'恭喜亲通过订单转换获得'.$data['integral'].'积分',$data['id']);
- }
- if($ck['sh_status'] != 1 && $data['sh_status'] == 1 && $data['growth'] > 0 && $data['uid']) {
- update_user_growth($data['uid'],$data['growth'],4,'恭喜亲通过订单转换获得'.$data['growth'].'成长值',$data['id']);
- }
- $data['ck_time'] = date("Y-m-d H:i:s");
- }
- }
- }
|