OrderShift.php 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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','%'.$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. $this->_form($this->table, 'form');
  42. }
  43. protected function _form_filter(&$data)
  44. {
  45. // 查看
  46. if($this->request->isGet() && $this->request->action() == 'aduit')
  47. {
  48. $this->user = Db::table('store_member')
  49. ->field('headimg,name,phone')
  50. ->find($data['uid']);
  51. }
  52. // 积分赠送integral_info
  53. if($this->request->isPost() && $this->request->action() == 'aduit') {
  54. if($data['sh_status'] == 1 && $data['integral'] && $data['uid']) {
  55. update_user_integral($data['uid'],$data['integral'],4,'积分转换',$data['id']);
  56. }
  57. $data['ck_time'] = date("Y-m-d H:i:s");
  58. }
  59. }
  60. }