12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- <?php
- namespace app\store\controller;
- use library\Controller;
- use think\Db;
- /**
- * 积分兑换
- * Class Order
- * @package app\store\controller
- */
- class Convert extends Controller
- {
- protected $table = "IntegralConvert";
- /**
- * 订单列表
- * @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').'%'];;
- $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.user_id ','LEFT');
- if(!empty($where)) $query->where($where);
- $query ->order('o.sh_status asc ,o.id desc')->page();
- }
- /**
- * 订单审核
- * @auth true
- * @menu true
- */
- public function audit()
- {
- $this->title = '审核';
- $this->_form($this->table, 'form');
- }
- protected function _form_filter(&$data)
- {
- // 查看
- if($this->request->isGet() && $this->request->action() == 'audit')
- {
- $this->user = Db::table('store_member')
- ->field('headimg,name,phone')
- ->find($data['user_id']);
- }
- // 积分赠送integral_info
- if($this->request->isPost() && $this->request->action() == 'audit') {
- $ck = Db::table('order_shift')->find($data['id']);
- if($ck['sh_status'] != 1 && $data['sh_status'] == 1 && $data['integral'] > 0 && $data['user_id']) {
- update_user_integral($data['user_id'],$data['integral'],10,'恭喜亲通过兑换获得'.$data['integral'].'积分',$data['id']);
- }
- if($ck['sh_status'] != 1 && $data['sh_status'] == 1 && $data['growth'] > 0 && $data['user_id']) {
- update_user_growth($data['user_id'],$data['growth'],10,'恭喜亲通过兑换获得'.$data['growth'].'成长值',$data['id']);
- }
- $data['ck_time'] = date("Y-m-d H:i:s");
- }
- }
- }
|