Service.php 1.9 KB

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