123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155 |
- <?php
- namespace app\controller\admin\v1\work;
- use app\controller\admin\AuthController;
- use app\services\user\UserServices;
- use app\services\work\WorkClientServices;
- use crmeb\services\wechat\config\WorkConfig;
- use think\facade\App;
- class Client extends AuthController
- {
-
- public function __construct(App $app, WorkClientServices $services)
- {
- parent::__construct($app);
- $this->services = $services;
- }
-
- public function index(WorkConfig $config)
- {
- $where = $this->request->getMore([
- ['time', ''],
- ['userid', []],
- ['label', []],
- ['name', ''],
- ['field_key', ''],
- ['gender', 0],
- ['status', 0],
- ['state', 0],
- ]);
- $where['corp_id'] = $config->get('corpId');
- $where['timeKey'] = 'create_time';
- return $this->success($this->services->getList($where));
- }
-
- public function userList(UserServices $services)
- {
- $where = $this->request->getMore([
- ['time', '', '', 'user_time'],
- ['name', '', '', 'nickname'],
- ['field_key', ''],
- ['gender', 0, '', 'sex'],
- ]);
- return $this->success($services->index($where));
- }
-
- public function synch()
- {
- $this->services->authGetExternalcontact();
- return $this->success('已加入消息队列,请稍后查看');
- }
-
- public function update($id)
- {
- $data = $this->request->postMore([
- ['remark', '']
- ]);
- if (!$id) {
- return $this->fail('缺少参数');
- }
- $this->services->update($id, $data);
- return $this->success('修改成功');
- }
-
- public function batchLabel()
- {
- [$labelId, $removeTag, $userId, $isAll] = $this->request->postMore([
- ['add_tag', []],
- ['removeTag', []],
- ['userid', []],
- ['is_all', 0]
- ], true);
- if (!$labelId) {
- return $this->fail('请选择标签');
- }
- if (!$isAll && !$userId) {
- return $this->fail('请选择客户');
- }
- $where = $this->request->getMore([
- ['time', ''],
- ['userid', []],
- ['label', []],
- ['name', ''],
- ['field_key', ''],
- ['gender', 0],
- ['status', 0],
- ['state', 0],
- ]);
- $this->services->synchBatchLabel($labelId, $removeTag, $userId, $where, (int)$isAll);
- return $this->success('已加入消息队列');
- }
-
- public function count()
- {
- $where = $this->request->postMore([
- ['userid', []],
- ['time', ''],
- ['label', []],
- ['notLabel', []],
- ['is_all', 0]
- ]);
- return $this->success(['sum_count' => $this->services->getUserIdsByCount($where)]);
- }
- }
|