Merge branch 'feature/user0812' into develop_bm
# Conflicts: # app/admin/service/UserService.php # config/route.php
This commit is contained in:
@@ -19,6 +19,42 @@ class UserController extends BaseController
|
|||||||
$this->service = new UserService();
|
$this->service = new UserService();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改密码
|
||||||
|
* @param Request $request
|
||||||
|
* @return \support\Response
|
||||||
|
* @throws \Random\RandomException
|
||||||
|
*/
|
||||||
|
public function savePassword(Request $request)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$data = $this->validate($this->service->getValidator(), $request->post(), 'password');
|
||||||
|
$data = $request->all();
|
||||||
|
$result = $this->service->savePassword($request,$data);;
|
||||||
|
return $this->success($result, '编辑成功');
|
||||||
|
} catch (\Throwable $e) {
|
||||||
|
return $this->error($e->getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新
|
||||||
|
*
|
||||||
|
* @param Request $request 请求对象
|
||||||
|
* @return mixed 返回更新成功的数据或信息
|
||||||
|
*/
|
||||||
|
public function edit(Request $request)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$data = $this->validate($this->service->getValidator(), $request->post(), 'update');
|
||||||
|
$res = $this->service->serviceUpdate($request, $data);
|
||||||
|
return $this->success([], '更新成功');
|
||||||
|
} catch (\Throwable $e) {
|
||||||
|
return $this->error($e->getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 列表页数据格式化
|
* 列表页数据格式化
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -3,9 +3,10 @@
|
|||||||
namespace app\admin\service;
|
namespace app\admin\service;
|
||||||
|
|
||||||
use app\admin\logic\UserLogic;
|
use app\admin\logic\UserLogic;
|
||||||
use app\admin\validate\UserValidate;
|
|
||||||
use app\common\traits\crud\CrudServiceTrait;
|
use app\common\traits\crud\CrudServiceTrait;
|
||||||
use app\common\model\User;
|
use app\common\model\User;
|
||||||
|
use app\common\validate\UserValidate;
|
||||||
|
use support\exception\BusinessException;
|
||||||
use support\Request;
|
use support\Request;
|
||||||
|
|
||||||
class UserService
|
class UserService
|
||||||
@@ -31,6 +32,14 @@ class UserService
|
|||||||
return new $this->validator;
|
return new $this->validator;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 更新 */
|
||||||
|
public function serviceUpdate(Request $request, array $data = [])
|
||||||
|
{
|
||||||
|
$data = $this->preProcess('Update', $data, $request);
|
||||||
|
$config = $this->buildQueryConfig($request, 'edit');
|
||||||
|
$updated = $this->logicUpdateBy($config, $data);
|
||||||
|
return $this->postProcess('Update', $data);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 构造 CrudUtil 查询配置
|
* 构造 CrudUtil 查询配置
|
||||||
@@ -75,6 +84,12 @@ class UserService
|
|||||||
case 'destroy':
|
case 'destroy':
|
||||||
$config['where']['id'] = $p['id'];
|
$config['where']['id'] = $p['id'];
|
||||||
break;
|
break;
|
||||||
|
case 'savePassword':
|
||||||
|
$config['where']['id'] = $p['id'];
|
||||||
|
break;
|
||||||
|
case 'edit':
|
||||||
|
$config['where']['id'] = $request->user->uid;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $config;
|
return $config;
|
||||||
@@ -103,4 +118,15 @@ class UserService
|
|||||||
{
|
{
|
||||||
return (new UserLogic())->updateUserResources($data);
|
return (new UserLogic())->updateUserResources($data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改用户密码
|
||||||
|
*/
|
||||||
|
public function savePassword(Request $request, array $data)
|
||||||
|
{
|
||||||
|
$config = $this->buildQueryConfig($request, 'savePassword');
|
||||||
|
$data['password'] = password_hash($data['password'], PASSWORD_DEFAULT);
|
||||||
|
$user = $this->logicUpdateBy($config,$data);
|
||||||
|
return $user;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -2,12 +2,61 @@
|
|||||||
|
|
||||||
namespace app\common\controller;
|
namespace app\common\controller;
|
||||||
|
|
||||||
|
use app\common\traits\crud\CrudControllerTrait;
|
||||||
use support\Request;
|
use support\Request;
|
||||||
use app\common\service\UserService;
|
use app\common\service\UserService;
|
||||||
|
|
||||||
class UserController extends BaseController
|
class UserController extends BaseController
|
||||||
{
|
{
|
||||||
|
|
||||||
|
use CrudControllerTrait;
|
||||||
|
|
||||||
|
protected $service;
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->service = new UserService();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取组员列表
|
||||||
|
*
|
||||||
|
* @param Request $request 请求对象
|
||||||
|
* @return mixed 返回分页数据及总数
|
||||||
|
*/
|
||||||
|
public function team(Request $request)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$raw = $this->service->serviceTeam($request);
|
||||||
|
$data = $this->transformData($raw, method_exists($this, 'indexFormat')
|
||||||
|
? [$this, 'indexFormat']
|
||||||
|
: null);
|
||||||
|
return $this->success($data);
|
||||||
|
} catch (\Throwable $e) {
|
||||||
|
return $this->error($e->getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 标记组员离职
|
||||||
|
*
|
||||||
|
* @param Request $request 请求对象
|
||||||
|
* @return mixed 返回分页数据及总数
|
||||||
|
*/
|
||||||
|
public function resignMember(Request $request)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$userId = $request->post('user_id');
|
||||||
|
if(empty($userId)){
|
||||||
|
return $this->error('组员id不能为空');
|
||||||
|
}
|
||||||
|
$user = $this->service->resignMember($request);
|
||||||
|
return $this->success($user, '获取用户信息');
|
||||||
|
} catch (\Throwable $e) {
|
||||||
|
return $this->error($e->getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户信息(登录后调用)
|
* 用户信息(登录后调用)
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -3,10 +3,18 @@
|
|||||||
namespace app\common\logic;
|
namespace app\common\logic;
|
||||||
|
|
||||||
use app\common\model\User;
|
use app\common\model\User;
|
||||||
|
use app\common\traits\crud\CrudLogicTrait;
|
||||||
use support\exception\BusinessException;
|
use support\exception\BusinessException;
|
||||||
|
|
||||||
class UserLogic
|
class UserLogic
|
||||||
{
|
{
|
||||||
|
use CrudLogicTrait;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 指定当前要操作的模型
|
||||||
|
*/
|
||||||
|
protected string $modelClass = User::class;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户信息
|
* 用户信息
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ use support\Model;
|
|||||||
* @property string $email 邮箱
|
* @property string $email 邮箱
|
||||||
* @property integer $status 状态
|
* @property integer $status 状态
|
||||||
* @property string $system_code 系统码
|
* @property string $system_code 系统码
|
||||||
|
* @property string $report_to 上级用户ID
|
||||||
* @property string $created_at
|
* @property string $created_at
|
||||||
* @property string $updated_at
|
* @property string $updated_at
|
||||||
*/
|
*/
|
||||||
@@ -69,6 +70,7 @@ class User extends Model
|
|||||||
'position',
|
'position',
|
||||||
'socialize',
|
'socialize',
|
||||||
'socialize_pic',
|
'socialize_pic',
|
||||||
|
'report_to',
|
||||||
];
|
];
|
||||||
|
|
||||||
// 用户所有角色
|
// 用户所有角色
|
||||||
|
|||||||
@@ -5,12 +5,21 @@ namespace app\common\service;
|
|||||||
use app\common\logic\UserLogic;
|
use app\common\logic\UserLogic;
|
||||||
use app\common\model\Corp;
|
use app\common\model\Corp;
|
||||||
use app\common\model\User;
|
use app\common\model\User;
|
||||||
|
use app\common\traits\crud\CrudLogicTrait;
|
||||||
|
use app\common\traits\crud\CrudServiceTrait;
|
||||||
use app\common\utils\CrudUtil;
|
use app\common\utils\CrudUtil;
|
||||||
use app\crm\model\Country;
|
use app\crm\model\Country;
|
||||||
use support\exception\BusinessException;
|
use support\exception\BusinessException;
|
||||||
|
use support\Request;
|
||||||
|
|
||||||
class UserService
|
class UserService
|
||||||
{
|
{
|
||||||
|
use CrudServiceTrait;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 指定当前要操作的模型
|
||||||
|
*/
|
||||||
|
protected string $modelClass = User::class;
|
||||||
|
|
||||||
protected $logic;
|
protected $logic;
|
||||||
|
|
||||||
@@ -110,4 +119,63 @@ class UserService
|
|||||||
{
|
{
|
||||||
return $this->logic->getList();
|
return $this->logic->getList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 分页列表 */
|
||||||
|
public function serviceTeam(Request $request)
|
||||||
|
{
|
||||||
|
if (method_exists($this, 'complexQuery')) {
|
||||||
|
$result = $this->complexQuery($request->get());
|
||||||
|
} else {
|
||||||
|
$config = $this->buildQueryConfig($request, 'team');
|
||||||
|
$limit = (int)$request->get('size', 15);
|
||||||
|
$page = (int)$request->get('current', 1);
|
||||||
|
$result = $this->logicList($config, $limit, $page);
|
||||||
|
}
|
||||||
|
return $this->postProcess('List', $result);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 分页列表 */
|
||||||
|
public function resignMember(Request $request)
|
||||||
|
{
|
||||||
|
$uid = $request->user->uid;
|
||||||
|
$userId = $request->post('user_id');
|
||||||
|
$user = User::find($userId);
|
||||||
|
if ($user->report_to != $uid) {
|
||||||
|
throw new BusinessException('禁止操作非组员');
|
||||||
|
}
|
||||||
|
|
||||||
|
$data = [
|
||||||
|
'status' => 2,
|
||||||
|
];
|
||||||
|
$user = $this->logic->edit($userId,$data);
|
||||||
|
$user = $user->toArray();
|
||||||
|
unset($user['password']);
|
||||||
|
unset($user['open_id']);
|
||||||
|
unset($user['tenant_key']);
|
||||||
|
unset($user['union_id']);
|
||||||
|
return $user;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 构造 CrudUtil 查询配置
|
||||||
|
*/
|
||||||
|
protected function buildQueryConfig(Request $request, string $scene = 'default'): array
|
||||||
|
{
|
||||||
|
$p = $request->all();
|
||||||
|
|
||||||
|
$config = [];
|
||||||
|
$config['model'] = $this->modelClass;
|
||||||
|
switch ($scene) {
|
||||||
|
case 'team':
|
||||||
|
// $config['where']['status'] = 1; // 关键字
|
||||||
|
$config['order']['id'] = 'desc';
|
||||||
|
|
||||||
|
$config['dataLimit']['type'] = 'relation';
|
||||||
|
$config['dataLimit']['userId'] = $request->user->uid;
|
||||||
|
$config['dataLimit']['userField'] = 'report_to';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $config;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -55,7 +55,8 @@ class UserValidate extends Validate
|
|||||||
'feishu_register' => ['feishu_code'],
|
'feishu_register' => ['feishu_code'],
|
||||||
'upwd_login' => ['account' => 'require|checkAccount', 'password'],
|
'upwd_login' => ['account' => 'require|checkAccount', 'password'],
|
||||||
'feishu_auth' => ['corp_abbr', 'system_code', 'login_type'],
|
'feishu_auth' => ['corp_abbr', 'system_code', 'login_type'],
|
||||||
'feishu_login' => ['feishu_code']
|
'feishu_login' => ['feishu_code'],
|
||||||
|
'password' => ['password'],
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -325,6 +325,7 @@ class CustomerController extends BaseController
|
|||||||
'lng' => Util::getParam($request, 'lng', 0),
|
'lng' => Util::getParam($request, 'lng', 0),
|
||||||
'address' => Util::getParam($request, 'address', ''),
|
'address' => Util::getParam($request, 'address', ''),
|
||||||
'sex' => Util::getParam($request, 'sex', 0),
|
'sex' => Util::getParam($request, 'sex', 0),
|
||||||
|
'obtain' => time(),
|
||||||
];
|
];
|
||||||
|
|
||||||
if (Util::isEmpty($id)) {
|
if (Util::isEmpty($id)) {
|
||||||
@@ -485,10 +486,10 @@ class CustomerController extends BaseController
|
|||||||
return $this->error(trans('customer_id').trans('not_null'));
|
return $this->error(trans('customer_id').trans('not_null'));
|
||||||
}
|
}
|
||||||
$data = [
|
$data = [
|
||||||
'user_id' => $request->user->uid
|
'user_id' => $request->user->uid,
|
||||||
|
'obtain' => time(),
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Db::beginTransaction();
|
Db::beginTransaction();
|
||||||
$customer= Customer::withTrashed()->find($customerId);
|
$customer= Customer::withTrashed()->find($customerId);
|
||||||
@@ -526,6 +527,51 @@ class CustomerController extends BaseController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 客户转移至公海
|
||||||
|
* @param Request $request
|
||||||
|
* @return \support\Response
|
||||||
|
*/
|
||||||
|
public function putSeas(Request $request)
|
||||||
|
{
|
||||||
|
$customerId = Util::getParam($request, 'customer_id');
|
||||||
|
$userId = $request->user->uid;
|
||||||
|
if (Util::isEmpty($customerId)) {
|
||||||
|
return $this->error(trans('customer_id').trans('not_null'));
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
Db::beginTransaction();
|
||||||
|
$customer= Customer::withTrashed()->where('user_id',$userId)->find($customerId);
|
||||||
|
|
||||||
|
if(empty($customer)){
|
||||||
|
return $this->error( 'customer_id错误');
|
||||||
|
}
|
||||||
|
$data = [
|
||||||
|
'user_id' => 0,
|
||||||
|
];
|
||||||
|
|
||||||
|
$res = $customer->update($data);
|
||||||
|
|
||||||
|
//记录客户关系变化
|
||||||
|
$his = CustomerHis::create([
|
||||||
|
'customer_id' => $customerId,
|
||||||
|
'user_his' => $userId,
|
||||||
|
'user_id' => 0,
|
||||||
|
]);
|
||||||
|
Db::commit();
|
||||||
|
} catch (\Throwable $e) {
|
||||||
|
Db::rollback();
|
||||||
|
return $this->error($e->getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($res) {
|
||||||
|
return $this->success($res, trans('success'));
|
||||||
|
} else {
|
||||||
|
return $this->error(trans('fail'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -547,6 +593,7 @@ class CustomerController extends BaseController
|
|||||||
try {
|
try {
|
||||||
$customer = $query->get();
|
$customer = $query->get();
|
||||||
|
|
||||||
|
Db::beginTransaction();
|
||||||
foreach ($customer as $item) {
|
foreach ($customer as $item) {
|
||||||
//记录客户关系变化
|
//记录客户关系变化
|
||||||
$his = CustomerHis::create([
|
$his = CustomerHis::create([
|
||||||
@@ -562,7 +609,12 @@ class CustomerController extends BaseController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$res = $query->update(['user_id' => $user->id]);
|
|
||||||
|
$data = [
|
||||||
|
'user_id' => $user->id,
|
||||||
|
'obtain' => time(),
|
||||||
|
];
|
||||||
|
$res = $query->update($data);
|
||||||
|
|
||||||
Db::commit();
|
Db::commit();
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
|
|||||||
@@ -162,6 +162,11 @@ class CustomerService
|
|||||||
return $config;
|
return $config;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 无用线索举报
|
||||||
|
* @param $params
|
||||||
|
* @return false
|
||||||
|
*/
|
||||||
public function report($params)
|
public function report($params)
|
||||||
{
|
{
|
||||||
$id = $params['id'];
|
$id = $params['id'];
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
namespace app\crmAdmin\controller;
|
namespace app\crmAdmin\controller;
|
||||||
|
|
||||||
use app\common\model\Corp;
|
use app\common\model\Corp;
|
||||||
|
use app\crm\model\Customer;
|
||||||
use app\crmAdmin\service\CustomerService;
|
use app\crmAdmin\service\CustomerService;
|
||||||
use support\Request;
|
use support\Request;
|
||||||
|
|
||||||
@@ -133,6 +134,37 @@ class CustomerController extends BaseController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 移除
|
||||||
|
* @param Request $request
|
||||||
|
* @return \support\Response
|
||||||
|
*/
|
||||||
|
public function delete(Request $request)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$param = $request->all();
|
||||||
|
if (empty($param['customer_id'])) {
|
||||||
|
return $this->error('customer_id'.trans('not_null'));
|
||||||
|
}
|
||||||
|
|
||||||
|
$where = [
|
||||||
|
'id' => $param['customer_id'],
|
||||||
|
];
|
||||||
|
$customer = Customer::where($where)->withTrashed()->first();
|
||||||
|
if(empty($customer)){
|
||||||
|
return $this->error( trans('fail'));
|
||||||
|
}
|
||||||
|
//软删除
|
||||||
|
$customer->status = 3;
|
||||||
|
$res = $customer->save();
|
||||||
|
$customer->delete();
|
||||||
|
|
||||||
|
return $this->success($res);
|
||||||
|
} catch (\Throwable $th) {
|
||||||
|
return $this->error($th->getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 客户详情
|
* 客户详情
|
||||||
* @param Request $request
|
* @param Request $request
|
||||||
@@ -154,4 +186,25 @@ class CustomerController extends BaseController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 客户详情
|
||||||
|
* @param Request $request
|
||||||
|
* @return \support\Response
|
||||||
|
*/
|
||||||
|
public function follow(Request $request)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$param = $request->all();
|
||||||
|
if (empty($param['id'])) {
|
||||||
|
return $this->error('id'.trans('not_null'));
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = (new CustomerService())->follow($param);
|
||||||
|
|
||||||
|
return $this->success($result);
|
||||||
|
} catch (\Throwable $th) {
|
||||||
|
return $this->error($th->getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -13,6 +13,10 @@ class CustomerLogic
|
|||||||
$customer->status = $status;
|
$customer->status = $status;
|
||||||
$res = $customer->save();
|
$res = $customer->save();
|
||||||
|
|
||||||
|
if($status == 1){
|
||||||
|
$customer->restore();
|
||||||
|
}
|
||||||
|
|
||||||
return $res;
|
return $res;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -20,7 +24,9 @@ class CustomerLogic
|
|||||||
{
|
{
|
||||||
$customer = Customer::withTrashed()->find($id);
|
$customer = Customer::withTrashed()->find($id);
|
||||||
//强制删除
|
//强制删除
|
||||||
$res = $customer->forceDelete();
|
// $res = $customer->forceDelete();
|
||||||
|
$customer->status = 3;
|
||||||
|
$res = $customer->save();
|
||||||
return $res;
|
return $res;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4,6 +4,7 @@ namespace app\crmAdmin\service;
|
|||||||
|
|
||||||
use app\common\model\InquiryLog;
|
use app\common\model\InquiryLog;
|
||||||
use app\common\model\User;
|
use app\common\model\User;
|
||||||
|
use app\common\service\OssService;
|
||||||
use app\crm\model\CustomerHis;
|
use app\crm\model\CustomerHis;
|
||||||
use app\crmAdmin\logic\CustomerLogic;
|
use app\crmAdmin\logic\CustomerLogic;
|
||||||
use app\crm\model\CarType;
|
use app\crm\model\CarType;
|
||||||
@@ -315,7 +316,42 @@ class CustomerService
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$res = $query->update(['user_id' => $userId]);
|
$data = [
|
||||||
|
'user_id' => $userId,
|
||||||
|
'obtain' => time(),
|
||||||
|
];
|
||||||
|
$res = $query->update($data);
|
||||||
|
|
||||||
|
Db::commit();
|
||||||
|
return $res;
|
||||||
|
} catch (\Throwable $e) {
|
||||||
|
Db::rollback();
|
||||||
|
throw $e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $params
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function delete($params)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
Db::beginTransaction();
|
||||||
|
$customerId = $params['customer_id'];
|
||||||
|
|
||||||
|
$query= Customer::whereIn('id',explode(',',$customerId));
|
||||||
|
$customer = $query->get();
|
||||||
|
|
||||||
|
foreach ($customer as $item) {
|
||||||
|
//记录客户关系变化
|
||||||
|
$his = CustomerHis::create([
|
||||||
|
'customer_id' => $item->id,
|
||||||
|
'user_his' => $item->user_id,
|
||||||
|
'user_id' => 0,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
$res = $query->update(['user_id' => 0]);
|
||||||
|
|
||||||
Db::commit();
|
Db::commit();
|
||||||
return $res;
|
return $res;
|
||||||
@@ -394,4 +430,19 @@ class CustomerService
|
|||||||
|
|
||||||
return $customer;
|
return $customer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function follow($params)
|
||||||
|
{
|
||||||
|
$id = $params['id'];
|
||||||
|
$follow = Follow::
|
||||||
|
where('customer_id', $id)
|
||||||
|
->first();
|
||||||
|
|
||||||
|
$ossservice = new OssService();
|
||||||
|
foreach ($follow as $item) {
|
||||||
|
$item['picture_full'] = $item->picture??$ossservice->generatePrivateUrl($item->picture);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $follow;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -60,6 +60,7 @@ class InquiryToCrm implements Consumer
|
|||||||
$crmCustomer->contacts = $info->contacts;
|
$crmCustomer->contacts = $info->contacts;
|
||||||
$crmCustomer->desc_collect = $info->content;
|
$crmCustomer->desc_collect = $info->content;
|
||||||
$crmCustomer->enter_user_id = $info->enter_user_id;
|
$crmCustomer->enter_user_id = $info->enter_user_id;
|
||||||
|
$crmCustomer->obtain = time();
|
||||||
// 修改同步CRM状态
|
// 修改同步CRM状态
|
||||||
$info->sync_crm = 1;
|
$info->sync_crm = 1;
|
||||||
// 保存
|
// 保存
|
||||||
|
|||||||
@@ -52,6 +52,8 @@ Route::group('/common', function () {
|
|||||||
Route::group('/user', function () {
|
Route::group('/user', function () {
|
||||||
Route::any('/info', [app\common\controller\UserController::class, 'info']);
|
Route::any('/info', [app\common\controller\UserController::class, 'info']);
|
||||||
Route::any('/get', [app\common\controller\UserController::class, 'getUser']);
|
Route::any('/get', [app\common\controller\UserController::class, 'getUser']);
|
||||||
|
Route::any('/team', [app\common\controller\UserController::class, 'team']);
|
||||||
|
Route::any('/resign', [app\common\controller\UserController::class, 'resignMember']);
|
||||||
});
|
});
|
||||||
|
|
||||||
Route::group('/preset', function () {
|
Route::group('/preset', function () {
|
||||||
@@ -73,6 +75,14 @@ Route::group('/admin', function () {
|
|||||||
Route::any('/menu/resource', [app\admin\controller\RoleController::class, 'menuResource']);
|
Route::any('/menu/resource', [app\admin\controller\RoleController::class, 'menuResource']);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// 用户
|
||||||
|
Route::group('/user', function () {
|
||||||
|
Route::any('/list', [app\admin\controller\UserController::class, 'index']);
|
||||||
|
Route::any('/show', [app\admin\controller\UserController::class, 'show']);
|
||||||
|
Route::any('/update', [app\admin\controller\UserController::class, 'update']);
|
||||||
|
Route::any('/update/password', [app\admin\controller\UserController::class, 'savePassword']);
|
||||||
|
});
|
||||||
|
|
||||||
// 公司
|
// 公司
|
||||||
Route::group('/corp', function () {
|
Route::group('/corp', function () {
|
||||||
Route::any('/list', [app\admin\controller\CorpController::class, 'index']);
|
Route::any('/list', [app\admin\controller\CorpController::class, 'index']);
|
||||||
@@ -149,6 +159,8 @@ Route::group('/admin', function () {
|
|||||||
Route::any('/audit', [app\crmAdmin\controller\CustomerController::class, 'audit']);
|
Route::any('/audit', [app\crmAdmin\controller\CustomerController::class, 'audit']);
|
||||||
Route::any('/transfer', [app\crmAdmin\controller\CustomerController::class, 'transfer']);
|
Route::any('/transfer', [app\crmAdmin\controller\CustomerController::class, 'transfer']);
|
||||||
Route::any('/detail', [app\crmAdmin\controller\CustomerController::class, 'detail']);
|
Route::any('/detail', [app\crmAdmin\controller\CustomerController::class, 'detail']);
|
||||||
|
Route::any('/delete', [app\crmAdmin\controller\CustomerController::class, 'delete']);
|
||||||
|
Route::any('/follow', [app\crmAdmin\controller\CustomerController::class, 'follow']);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -202,6 +214,7 @@ Route::group('/crm', function () {
|
|||||||
Route::any('/customer/getCountry', [app\crm\controller\CustomerController::class, 'getCountry']);
|
Route::any('/customer/getCountry', [app\crm\controller\CustomerController::class, 'getCountry']);
|
||||||
Route::any('/customer/followNext', [app\crm\controller\CustomerController::class, 'followNext']);
|
Route::any('/customer/followNext', [app\crm\controller\CustomerController::class, 'followNext']);
|
||||||
Route::any('/customer/report', [app\crm\controller\CustomerController::class, 'report']);
|
Route::any('/customer/report', [app\crm\controller\CustomerController::class, 'report']);
|
||||||
|
Route::any('/customer/seas', [app\crm\controller\CustomerController::class, 'putSeas']);
|
||||||
|
|
||||||
Route::any('/tagGroup/list', [app\crm\controller\TagGroupController::class, 'list']);
|
Route::any('/tagGroup/list', [app\crm\controller\TagGroupController::class, 'list']);
|
||||||
Route::any('/tagGroup/updatePivot', [app\crm\controller\TagGroupController::class, 'updatePivot']);
|
Route::any('/tagGroup/updatePivot', [app\crm\controller\TagGroupController::class, 'updatePivot']);
|
||||||
|
|||||||
Reference in New Issue
Block a user