OrderShift.php 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. <?php
  2. namespace app\store\controller;
  3. use library\Controller;
  4. use think\Db;
  5. /**
  6. * 订单转换
  7. * Class Order
  8. * @package app\store\controller
  9. */
  10. class OrderShift extends Controller
  11. {
  12. protected $table = "OrderShift";
  13. /**
  14. * 订单列表
  15. * @auth true
  16. * @menu true
  17. */
  18. public function index()
  19. {
  20. $this->title = '订单转换列表';
  21. $this->sh_status_desc = ['待审核','审核通过','审核拒绝'];
  22. $query = $this->_query($this->table);
  23. if($this->request->request('phone')) $where[]= ['m.phone','like','%'.$this->request->request('phone').'%'];
  24. if($this->request->request('order_no')) $where[]= ['o.order_no','like','%'.trim($this->request->request('order_no')).'%'];
  25. $this->sh_status = $this->request->request('sh_status',-1);
  26. if($this->sh_status > -1 ) $where[]= ['o.sh_status','=',$this->request->request('sh_status')];
  27. $query->alias('o')
  28. ->field('o.* ,m.headimg,m.name,m.phone')
  29. ->join('store_member m',' m.id = o.uid ','LEFT');
  30. if(!empty($where)) $query->where($where);
  31. $query ->order('o.sh_status asc ,o.id desc')->page();
  32. }
  33. /**
  34. * 订单审核
  35. * @auth true
  36. * @menu true
  37. */
  38. public function aduit()
  39. {
  40. $this->title = '订单审核';
  41. $audit_desc = Db::table('audit_desc')->where('is_deleted',0)->where('status',1)
  42. ->order('sort desc ,id desc')
  43. ->select();
  44. $audit_set = [];
  45. $audit_set[0]='请选择';
  46. foreach ($audit_desc as $dv) {
  47. $audit_set[$dv['id']]=$dv['title'];
  48. }
  49. $this->audit_set = $audit_set;
  50. $this->_form($this->table, 'form');
  51. }
  52. protected function _form_filter(&$data)
  53. {
  54. // 查看
  55. if($this->request->isGet() && $this->request->action() == 'aduit')
  56. {
  57. $this->user = Db::table('store_member')
  58. ->field('headimg,name,phone')
  59. ->find($data['uid']);
  60. }
  61. // 积分赠送integral_info
  62. if($this->request->isPost() && $this->request->action() == 'aduit') {
  63. $ck = Db::table('order_shift')->find($data['id']);
  64. if($ck['sh_status'] != 1 && $data['sh_status'] == 1 && $data['integral'] > 0 && $data['uid']) {
  65. update_user_integral($data['uid'],$data['integral'],4,'恭喜亲通过订单转换获得'.$data['integral'].'积分',$data['id']);
  66. }
  67. if($ck['sh_status'] != 1 && $data['sh_status'] == 1 && $data['growth'] > 0 && $data['uid']) {
  68. update_user_growth($data['uid'],$data['growth'],4,'恭喜亲通过订单转换获得'.$data['growth'].'成长值',$data['id']);
  69. }
  70. $data['ck_time'] = date("Y-m-d H:i:s");
  71. }
  72. }
  73. }