Service.php 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. /**
  3. *
  4. * @author: xaboy<365615158@qq.com>
  5. * @day: 2017/12/23
  6. */
  7. namespace app\wap\controller;
  8. use app\wap\model\store\StoreService;
  9. use app\wap\model\user\User;
  10. use app\admin\model\system\Merchant;
  11. use think\Request;
  12. class Service extends AuthController
  13. {
  14. public function service_list(Request $request){
  15. $params = Request::instance()->param();
  16. $merchant = isset($params['mer_id']) && $params['mer_id'] > 0 ? Merchant::where('id',$params['mer_id'])->find() : array("id"=>0,"mer_name"=>"");
  17. $list = StoreService::field('uid,avatar,nickname')->where('mer_id',$merchant['id'])->where('status',1)->order("id desc")->select();
  18. $this->assign(compact('list','merchant'));
  19. return $this->fetch();
  20. }
  21. public function service_ing(Request $request){
  22. $params = Request::instance()->param();
  23. $to_uid = $params['to_uid'];
  24. $merchant = isset($params['mer_id']) && $params['mer_id'] > 0 ? Merchant::where('id',$params['mer_id'])->find() : array("id"=>0,"mer_name"=>"");
  25. if(!isset($to_uid) || empty($to_uid))$this->failed('未获取到接收用户信息!');
  26. if($this->userInfo['uid'] == $to_uid)$this->failed('您不能进行自言自语!');
  27. //发送用户信息
  28. $now_user = StoreService::where('mer_id',$merchant['id'])->where(array("uid"=>$this->userInfo['uid']))->find();
  29. if(!$now_user)$now_user = User::getUserInfo($this->userInfo['uid']);
  30. $this->assign('user',$now_user);
  31. //接收用户信息
  32. $to_user = StoreService::where('mer_id',$merchant['id'])->where(array("uid"=>$to_uid))->find();
  33. if(!$to_user)$to_user = User::getUserInfo($to_uid);
  34. $this->assign([
  35. 'to_user'=>$to_user,
  36. 'merchant'=>$merchant,
  37. ]);
  38. return $this->fetch();
  39. }
  40. public function service_new(){
  41. return $this->fetch();
  42. }
  43. }