diff --git a/app/admin/controller/UserController.php b/app/admin/controller/UserController.php index a080444..b8eef18 100644 --- a/app/admin/controller/UserController.php +++ b/app/admin/controller/UserController.php @@ -18,6 +18,60 @@ class UserController extends BaseController { $this->service = new UserService(); } + /** + * 更新 + * + * @param Request $request 请求对象 + * @return mixed 返回更新成功的数据或信息 + */ + public function update(Request $request) + { + try { + $data = $request->post(); + $res = $this->service->serviceUpdateUser($request, $data); + return $this->success([], '更新成功'); + } catch (\Throwable $e) { + return $this->error($e->getMessage()); + } + } + + /** + * 修改密码 + * @param Request $request + * @return \support\Response + * @throws \Random\RandomException + */ + public function savePassword(Request $request) + { + try { + $data = $request->all(); + if(empty($data['password'])){ + return $this->error('密码不能为空'); + } + $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'); + $data['id'] = $data['id']??$request->user->uid; + $res = $this->service->serviceUpdate($request, $data); + return $this->success([], '更新成功'); + } catch (\Throwable $e) { + return $this->error($e->getMessage()); + } + } /** * 列表页数据格式化 diff --git a/app/admin/service/UserService.php b/app/admin/service/UserService.php index d807db1..75b47b1 100644 --- a/app/admin/service/UserService.php +++ b/app/admin/service/UserService.php @@ -3,9 +3,10 @@ namespace app\admin\service; use app\admin\logic\UserLogic; -use app\admin\validate\UserValidate; use app\common\traits\crud\CrudServiceTrait; use app\common\model\User; +use app\common\validate\UserValidate; +use support\exception\BusinessException; use support\Request; class UserService @@ -31,6 +32,23 @@ class UserService return new $this->validator; } + /** 更新 */ + public function serviceUpdateUser(Request $request, array $data = []) + { + $data = $this->preProcess('Update', $data, $request); + $config = $this->buildQueryConfig($request, 'update'); + $updated = $this->logicUpdateBy($config, $data); + return $this->postProcess('Update', $data); + } + + /** 更新 */ + 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 查询配置 @@ -62,7 +80,7 @@ class UserService $config['where']['id'] = $p['id']; } - $config['fields'] = ['id','sn', 'name', 'email', 'sex', 'phone', 'avatar', 'corp_id', 'country_id', 'position', 'status', 'created_at']; + $config['fields'] = ['id','sn', 'name', 'email', 'sex', 'phone', 'avatar', 'corp_id', 'country_id', 'position', 'report_to', 'status', 'created_at']; $config['with']['roles'][] = 'id'; $config['with']['roles'][] = 'name'; @@ -80,6 +98,12 @@ class UserService case 'destroy': $config['where']['id'] = $p['id']; break; + case 'savePassword': + $config['where']['id'] = $p['id']; + break; + case 'edit': + $config['where']['id'] = $request->user->uid; + break; } return $config; @@ -108,4 +132,15 @@ class UserService { 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; + } } \ No newline at end of file diff --git a/app/command/CustomerCodeCommand.php b/app/command/CustomerCodeCommand.php index 2d3e447..a82ec0f 100644 --- a/app/command/CustomerCodeCommand.php +++ b/app/command/CustomerCodeCommand.php @@ -44,7 +44,8 @@ class CustomerCodeCommand extends SymfonyCommand $code = 'CM' . $unique; } - $obtain = $customer->created_at>strtotime('2025-07-29')?$customer->created_at:strtotime('2025-07-29'); + $created_at = $customer->created_at->getTimestamp(); + $obtain = $created_at > strtotime('2025-07-29')?$created_at:strtotime('2025-07-29'); $customer->code = $code; $customer->obtain = $obtain; diff --git a/app/common/controller/UserController.php b/app/common/controller/UserController.php index a69f32b..d4fe0f4 100644 --- a/app/common/controller/UserController.php +++ b/app/common/controller/UserController.php @@ -2,12 +2,61 @@ namespace app\common\controller; +use app\common\traits\crud\CrudControllerTrait; use support\Request; use app\common\service\UserService; 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()); + } + } + /** * 用户信息(登录后调用) */ @@ -23,57 +72,57 @@ class UserController extends BaseController } } - // /** - // * 用户信息 - // */ - // public function getUser(Request $request) - // { - // try { - // $uid = $request->user->uid; - // $corp_abbr = $request->basic_data['corp_abbr']; - // $result = (new UserService())->getUser($uid,$corp_abbr); - // return $this->success($result, '获取用户信息'); - // } catch (\Throwable $e) { - // return $this->error($e->getMessage()); - // } - // } + /** + * 用户信息 + */ + public function getUser(Request $request) + { + try { + $uid = $request->user->uid; + $corp_abbr = $request->basic_data['corp_abbr']; + $result = (new UserService())->getUser($uid,$corp_abbr); + return $this->success($result, '获取用户信息'); + } catch (\Throwable $e) { + return $this->error($e->getMessage()); + } + } - // /** - // * 编辑用户 - // */ - // public function edit(Request $request) - // { - // try { - // $uid = $request->user->uid; - // $data = $request->all(); - // $result = (new UserService())->edit($uid,$data); - // unset($result['password']); - // unset($result['union_id']); - // unset($result['open_id']); - // unset($result['tenant_key']); - // return $this->success($result, '编辑成功'); - // } catch (\Throwable $e) { - // return $this->error($e->getMessage()); - // } - // } + /** + * 编辑用户 + */ + public function edit(Request $request) + { + try { + $uid = $request->user->uid; + $data = $request->all(); + $result = (new UserService())->edit($uid,$data); + unset($result['password']); + unset($result['union_id']); + unset($result['open_id']); + unset($result['tenant_key']); + return $this->success($result, '编辑成功'); + } catch (\Throwable $e) { + return $this->error($e->getMessage()); + } + } - // /** - // * 修改密码 - // * @param Request $request - // * @return \support\Response - // * @throws \Random\RandomException - // */ - // public function savePassword(Request $request) - // { - // try { - // $uid = $request->user->uid; - // $data = $request->all(); - // $result = (new UserService())->savePassword($uid,$data);; - // return $this->success($result, '编辑成功'); - // } catch (\Throwable $e) { - // return $this->error($e->getMessage()); - // } - // } + /** + * 修改密码 + * @param Request $request + * @return \support\Response + * @throws \Random\RandomException + */ + public function savePassword(Request $request) + { + try { + $uid = $request->user->uid; + $data = $request->all(); + $result = (new UserService())->savePassword($uid,$data);; + return $this->success($result, '编辑成功'); + } catch (\Throwable $e) { + return $this->error($e->getMessage()); + } + } } \ No newline at end of file diff --git a/app/common/logic/UserLogic.php b/app/common/logic/UserLogic.php index 9f5ae44..c7d5343 100644 --- a/app/common/logic/UserLogic.php +++ b/app/common/logic/UserLogic.php @@ -3,10 +3,18 @@ namespace app\common\logic; use app\common\model\User; +use app\common\traits\crud\CrudLogicTrait; use support\exception\BusinessException; class UserLogic { + use CrudLogicTrait; + + /** + * 指定当前要操作的模型 + */ + protected string $modelClass = User::class; + /** * 用户信息 */ diff --git a/app/common/model/CrmCustomer.php b/app/common/model/CrmCustomer.php index 49446e6..bc439db 100644 --- a/app/common/model/CrmCustomer.php +++ b/app/common/model/CrmCustomer.php @@ -46,4 +46,31 @@ class CrmCustomer extends Model * 不允许自动填充模型字段 */ protected $guarded = []; + + protected static function booted() + { + static::saved(function ($customer) { + if (empty($customer->code)) { + $customer->code = self::generateCustomerCode($customer); + // 使用saveQuietly避免递归调用 + $customer->saveQuietly(); + } + }); + } + + public static function generateCustomerCode($customer) + { + // 生成唯一16位code,CM+14位 + $unique = strtoupper(substr(md5($customer->id . microtime(true) . mt_rand(1000, 9999)), 8, 6)); + $code = 'CM' . date('Ymd') .$unique; + return $code; + } + + // 静默保存方法,不触发事件 + public function saveQuietly(array $options = []) + { + return static::withoutEvents(function () use ($options) { + return $this->save($options); + }); + } } \ No newline at end of file diff --git a/app/common/model/User.php b/app/common/model/User.php index 446ed46..88c670d 100644 --- a/app/common/model/User.php +++ b/app/common/model/User.php @@ -15,7 +15,8 @@ use support\Model; * @property string $email 邮箱 * @property integer $status 状态 * @property string $system_code 系统码 - * @property string $created_at + * @property string $report_to 上级用户ID + * @property string $created_at * @property string $updated_at */ class User extends Model @@ -69,6 +70,7 @@ class User extends Model 'position', 'socialize', 'socialize_pic', + 'report_to', ]; // 用户所有角色 diff --git a/app/common/service/UserService.php b/app/common/service/UserService.php index cccda73..f3c28d1 100644 --- a/app/common/service/UserService.php +++ b/app/common/service/UserService.php @@ -5,12 +5,22 @@ namespace app\common\service; use app\common\logic\UserLogic; use app\common\model\Corp; use app\common\model\User; +use app\common\traits\crud\CrudLogicTrait; +use app\common\traits\crud\CrudServiceTrait; use app\common\utils\CrudUtil; use app\crm\model\Country; +use app\crm\model\Customer; use support\exception\BusinessException; +use support\Request; class UserService { + use CrudServiceTrait; + + /** + * 指定当前要操作的模型 + */ + protected string $modelClass = User::class; protected $logic; @@ -28,6 +38,7 @@ class UserService // $permService = new PermService(); // $menuTree = $permService->getMenuTree($uid, $systemCode); // $permissionCodes = $permService->getPermissionCodes($uid, $systemCode); + $corp_name = Corp::where('abbr', $user->corp_id)->value('name'); return [ 'user' => [ 'id' => $user->id, @@ -36,7 +47,11 @@ class UserService 'phone' => $user->phone, 'email' => $user->email, 'status' => $user->status, - 'roles' => $user->roles->pluck('name') + 'roles' => $user->roles->pluck('name'), + 'sex' => $user->sex, + 'sn' => $user->sn, + 'corp_id' => $user->corp_id, + 'corp_name' => $corp_name, ], // 'menu' => $menuTree, // 'permissions' => $permissionCodes @@ -110,4 +125,72 @@ class UserService { 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); + } + + foreach ($result as &$data){ + $data['customer_count'] = Customer::where('user_id', $data['id'])->count(); + unset($data['password']); + unset($data['open_id']); + unset($data['tenant_key']); + unset($data['union_id']); + } + + 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; + } } \ No newline at end of file diff --git a/app/common/validate/UserValidate.php b/app/common/validate/UserValidate.php index 7db260d..dcdaa9b 100644 --- a/app/common/validate/UserValidate.php +++ b/app/common/validate/UserValidate.php @@ -55,7 +55,7 @@ class UserValidate extends Validate 'feishu_register' => ['feishu_code'], 'upwd_login' => ['account' => 'require|checkAccount', 'password'], 'feishu_auth' => ['corp_abbr', 'system_code', 'login_type'], - 'feishu_login' => ['feishu_code'] + 'feishu_login' => ['feishu_code'], ]; /** diff --git a/app/crm/controller/CustomerController.php b/app/crm/controller/CustomerController.php index d1e7cdb..b00af0d 100644 --- a/app/crm/controller/CustomerController.php +++ b/app/crm/controller/CustomerController.php @@ -325,6 +325,7 @@ class CustomerController extends BaseController 'lng' => Util::getParam($request, 'lng', 0), 'address' => Util::getParam($request, 'address', ''), 'sex' => Util::getParam($request, 'sex', 0), + 'obtain' => time(), ]; if (Util::isEmpty($id)) { @@ -393,13 +394,31 @@ class CustomerController extends BaseController if(empty($customer)){ return $this->error( trans('fail')); } - if($force == 'force'){ - //强制删除 - $res = $customer->forceDelete(); - }else{ - //软删除 - $res = $customer->delete(); + try { + Db::beginTransaction(); + if ($force == 'force') { + //强制删除 + $res = $customer->forceDelete(); + } else { + $customer->user_id = 0; + $customer->save(); + + //记录客户关系变化 + $his = CustomerHis::create([ + 'customer_id' => $id, + 'user_his' => $userId, + 'user_id' => 0, + ]); + + //软删除 + $res = $customer->delete(); + } + Db::commit(); + } catch (\Throwable $e) { + Db::rollback(); + return $this->error($e->getMessage()); } + if ($res) { return $this->success($res, trans('success')); } else { @@ -485,10 +504,10 @@ class CustomerController extends BaseController return $this->error(trans('customer_id').trans('not_null')); } $data = [ - 'user_id' => $request->user->uid + 'user_id' => $request->user->uid, + 'obtain' => time(), ]; - try { Db::beginTransaction(); $customer= Customer::withTrashed()->find($customerId); @@ -526,8 +545,6 @@ class CustomerController extends BaseController } } - - /** * 批量转让 * @param Request $request @@ -547,6 +564,7 @@ class CustomerController extends BaseController try { $customer = $query->get(); + Db::beginTransaction(); foreach ($customer as $item) { //记录客户关系变化 $his = CustomerHis::create([ @@ -562,7 +580,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(); } catch (\Throwable $e) { diff --git a/app/crm/model/Customer.php b/app/crm/model/Customer.php index af5c571..326eb72 100644 --- a/app/crm/model/Customer.php +++ b/app/crm/model/Customer.php @@ -79,4 +79,31 @@ class Customer extends Model { return $this->belongsTo(User::class, 'user_id', 'id'); } + + protected static function booted() + { + static::saved(function ($customer) { + if (empty($customer->code)) { + $customer->code = self::generateCustomerCode($customer); + // 使用saveQuietly避免递归调用 + $customer->saveQuietly(); + } + }); + } + + public static function generateCustomerCode($customer) + { + // 生成唯一16位code,CM+14位 + $unique = strtoupper(substr(md5($customer->id . microtime(true) . mt_rand(1000, 9999)), 8, 6)); + $code = 'CM' . date('Ymd') .$unique; + return $code; + } + + // 静默保存方法,不触发事件 + public function saveQuietly(array $options = []) + { + return static::withoutEvents(function () use ($options) { + return $this->save($options); + }); + } } \ No newline at end of file diff --git a/app/crm/service/CustomerService.php b/app/crm/service/CustomerService.php index 8621636..29c84ce 100644 --- a/app/crm/service/CustomerService.php +++ b/app/crm/service/CustomerService.php @@ -36,6 +36,7 @@ class CustomerService $follow = $params['follow'] ?? ''; $follow_last = $params['follow_last'] ?? ''; $tagId = $params['tag_id'] ?? []; + $countryId = $params['country_id'] ?? ''; $where = []; $user_id =$params['user_id']; @@ -49,6 +50,9 @@ class CustomerService } $where[] = ['status', 1]; + if (!empty($countryId)){ + $where[] = ['country_id', $countryId]; + } $grade = []; if (!Util::isEmpty($follow) && $follow == 0) { @@ -84,7 +88,9 @@ class CustomerService if (!Util::isEmpty($keyword)) { $query->where(function ($query) use ($keyword) { $query->where('contacts', 'like', "%{$keyword}%") - ->orWhere('phone', 'like', "%{$keyword}%"); + ->orWhere('phone', 'like', "%{$keyword}%") + ->orWhere('WhatsApp', 'like', "%{$keyword}%") + ->orWhere('code', 'like', "%{$keyword}%"); }); } if (!Util::isEmpty($grade)) { @@ -162,6 +168,11 @@ class CustomerService return $config; } + /** + * 无用线索举报 + * @param $params + * @return false + */ public function report($params) { $id = $params['id']; diff --git a/app/crmAdmin/controller/CustomerController.php b/app/crmAdmin/controller/CustomerController.php index 153941a..a3dc0e2 100644 --- a/app/crmAdmin/controller/CustomerController.php +++ b/app/crmAdmin/controller/CustomerController.php @@ -3,6 +3,7 @@ namespace app\crmAdmin\controller; use app\common\model\Corp; +use app\crm\model\Customer; use app\crmAdmin\service\CustomerService; 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 @@ -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()); + } + } + } \ No newline at end of file diff --git a/app/crmAdmin/logic/CustomerLogic.php b/app/crmAdmin/logic/CustomerLogic.php index 869982f..83ba426 100644 --- a/app/crmAdmin/logic/CustomerLogic.php +++ b/app/crmAdmin/logic/CustomerLogic.php @@ -13,6 +13,10 @@ class CustomerLogic $customer->status = $status; $res = $customer->save(); + if($status == 1){ + $customer->restore(); + } + return $res; } @@ -20,7 +24,9 @@ class CustomerLogic { $customer = Customer::withTrashed()->find($id); //强制删除 - $res = $customer->forceDelete(); +// $res = $customer->forceDelete(); + $customer->status = 3; + $res = $customer->save(); return $res; } } \ No newline at end of file diff --git a/app/crmAdmin/service/CustomerService.php b/app/crmAdmin/service/CustomerService.php index 6a68ee7..e079a03 100644 --- a/app/crmAdmin/service/CustomerService.php +++ b/app/crmAdmin/service/CustomerService.php @@ -4,6 +4,7 @@ namespace app\crmAdmin\service; use app\common\model\InquiryLog; use app\common\model\User; +use app\common\service\OssService; use app\crm\model\CustomerHis; use app\crmAdmin\logic\CustomerLogic; use app\crm\model\CarType; @@ -104,7 +105,9 @@ class CustomerService if (!Util::isEmpty($keyword)) { $query->where(function ($query) use ($keyword) { $query->where('contacts', 'like', "%{$keyword}%") - ->orWhere('phone', 'like', "%{$keyword}%"); + ->orWhere('phone', 'like', "%{$keyword}%") + ->orWhere('WhatsApp', 'like', "%{$keyword}%") + ->orWhere('code', 'like', "%{$keyword}%"); }); } if (!Util::isEmpty($grade)) { @@ -124,6 +127,7 @@ class CustomerService if (!$export) { foreach ($customer as &$item) { $item = $this->getCustomer($item); + $item['desc_collect'] = $item['desc_collect'] ?? ''; $item['follow_next'] = empty($item['follow_next'])?'':date('Y-m-d H:i:s', $item['follow_next']); if ($seas == 'seas' || $scene == 'seas') { $item['seas_time'] = time() - strtotime($item['deleted_at']); @@ -315,7 +319,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(); return $res; @@ -394,4 +433,19 @@ class CustomerService return $customer; } + + public function follow($params) + { + $id = $params['id']; + $follow = Follow:: + where('customer_id', $id) + ->get(); + + $ossservice = new OssService(); + foreach ($follow as $item) { + $item['picture_full'] = empty($item->picture)?'':$ossservice->generatePrivateUrl($item->picture); + } + + return $follow; + } } \ No newline at end of file diff --git a/app/queue/redis/InquiryToCrm.php b/app/queue/redis/InquiryToCrm.php index 8e1ae51..7bec9ca 100644 --- a/app/queue/redis/InquiryToCrm.php +++ b/app/queue/redis/InquiryToCrm.php @@ -60,6 +60,7 @@ class InquiryToCrm implements Consumer $crmCustomer->contacts = $info->contacts; $crmCustomer->desc_collect = $info->content; $crmCustomer->enter_user_id = $info->enter_user_id; + $crmCustomer->obtain = time(); // 修改同步CRM状态 $info->sync_crm = 1; // 保存 diff --git a/config/route.php b/config/route.php index 7b93165..9c33c32 100644 --- a/config/route.php +++ b/config/route.php @@ -51,7 +51,9 @@ Route::group('/common', function () { Route::group('/user', function () { 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 () { @@ -119,8 +121,10 @@ Route::group('/admin', 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('/edit', [app\admin\controller\UserController::class, 'edit']); Route::any('/authorize', [app\admin\controller\UserController::class, 'authorize']); Route::any('/set/resources', [app\admin\controller\UserController::class, 'updateResources']); + Route::any('/update/password', [app\admin\controller\UserController::class, 'savePassword']); }); // 询单 @@ -152,6 +156,9 @@ Route::group('/admin', function () { Route::any('/audit', [app\crmAdmin\controller\CustomerController::class, 'audit']); Route::any('/transfer', [app\crmAdmin\controller\CustomerController::class, 'transfer']); Route::any('/detail', [app\crmAdmin\controller\CustomerController::class, 'detail']); + Route::any('/delete', [app\crmAdmin\controller\CustomerController::class, 'delete']); + Route::any('/cede', [app\crm\controller\CustomerController::class, 'cede']); + Route::any('/follow', [app\crmAdmin\controller\CustomerController::class, 'follow']); }); }); }); @@ -212,7 +219,7 @@ Route::group('/crm', function () { Route::any('/upload/image', [app\common\controller\UploadController::class, 'uploadImage']); - // Route::any('/user/edit', [app\common\controller\UserController::class, 'edit']); - // Route::any('/user/savePassword', [app\common\controller\UserController::class, 'savePassword']); + Route::any('/user/edit', [app\common\controller\UserController::class, 'edit']); + Route::any('/user/savePassword', [app\common\controller\UserController::class, 'savePassword']); });