Service.php 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  8. // +----------------------------------------------------------------------
  9. // | Author: CRMEB Team <admin@crmeb.com>
  10. // +----------------------------------------------------------------------
  11. namespace app\wap\controller;
  12. use app\wap\model\store\StoreService;
  13. use service\SystemConfigService;
  14. use app\wap\model\user\User;
  15. use think\Request;
  16. class Service extends AuthController
  17. {
  18. public function service_list(Request $request){
  19. $params = Request::instance()->param();
  20. $merchant =array("id"=>0,"mer_name"=>"");
  21. $list = StoreService::field('uid,avatar,nickname')->where('mer_id',$merchant['id'])->where('status',1)->order("id desc")->select();
  22. $this->assign(compact('list','merchant'));
  23. return $this->fetch();
  24. }
  25. public function service_ing(Request $request){
  26. $params = Request::instance()->param();
  27. $to_uid = $params['to_uid'];
  28. $merchant =array("id"=>0,"mer_name"=>"");
  29. if(!isset($to_uid) || empty($to_uid))$this->failed('未获取到接收用户信息!');
  30. if($this->userInfo['uid'] == $to_uid)$this->failed('您不能进行自言自语!');
  31. //发送用户信息
  32. $now_user = StoreService::where('mer_id',$merchant['id'])->where(array("uid"=>$this->userInfo['uid']))->find();
  33. if(!$now_user)$now_user = User::getUserInfo($this->userInfo['uid']);
  34. $this->assign('user',$now_user);
  35. //接收用户信息
  36. $to_user = StoreService::where('mer_id',$merchant['id'])->where(array("uid"=>$to_uid))->find();
  37. if(!$to_user)$to_user = User::getUserInfo($to_uid);
  38. $this->assign([
  39. 'to_user'=>$to_user,
  40. 'merchant'=>$merchant,
  41. ]);
  42. return $this->fetch();
  43. }
  44. public function service_new(){
  45. return $this->fetch();
  46. }
  47. }