chuan 1 month ago
parent
commit
663fe65cd9
  1. 3
      app/home/controller/News.php
  2. 2
      app/home/route/app.php
  3. 4
      app/home/service/BaseHomeService.php
  4. 3
      app/home/service/LoginService.php
  5. 6
      app/model/AdminModel.php

3
app/home/controller/News.php

@ -2,6 +2,7 @@
namespace app\home\controller; namespace app\home\controller;
use app\model\AdminModel;
use app\model\EmailTemplateModel; use app\model\EmailTemplateModel;
use app\model\PurchaseVipModel; use app\model\PurchaseVipModel;
use app\model\UserChatLinkModel; use app\model\UserChatLinkModel;
@ -98,12 +99,14 @@ class News extends HomeBaseController
*/ */
public function testApi() public function testApi()
{ {
$customerIds = AdminModel::getCustomerIdsByAgentId(18);
$uniq = bin2hex(random_bytes(16)); $uniq = bin2hex(random_bytes(16));
return json([ return json([
'code' => '0', 'code' => '0',
'message' => lang('parameter_error'), 'message' => lang('parameter_error'),
'data' => [ 'data' => [
'random' => $uniq, 'random' => $uniq,
'customerIds' => $customerIds
], ],
]); ]);
} }

2
app/home/route/app.php

@ -299,7 +299,7 @@ Route::group('/',function (){
Route::post('get_ip', 'Login/getIP'); Route::post('get_ip', 'Login/getIP');
Route::get('get_news', 'News/index'); Route::get('get_news', 'News/index');
Route::post('test', 'News/testApi')->middleware(\app\home\middleware\AuthMiddleware::class); Route::post('test', 'News/testApi');
Route::post('test_api', 'Document/informationArticleList'); Route::post('test_api', 'Document/informationArticleList');

4
app/home/service/BaseHomeService.php

@ -108,6 +108,10 @@ class BaseHomeService
public function getUniqUserNo(): string public function getUniqUserNo(): string
{ {
$userNoData = UserNoModel::create(['created_time'=>date("Y-m-d H:i:s")]); $userNoData = UserNoModel::create(['created_time'=>date("Y-m-d H:i:s")]);
// P2要求序列号10000开始
if ($userNoData->id < 10000) {
$userNoData = UserNoModel::create(['id'=>10000,'created_time'=>date("Y-m-d H:i:s")]);
}
return 's'.$userNoData->id; return 's'.$userNoData->id;
// $code = 's'; // $code = 's';
// $code .= date('ymd'); // s230629 // $code .= date('ymd'); // s230629

3
app/home/service/LoginService.php

@ -585,7 +585,9 @@ class LoginService extends BaseHomeService
]); ]);
// 如果有代理,绑定到代理下一个客服(轮询客服绑定) // 如果有代理,绑定到代理下一个客服(轮询客服绑定)
if ($agentId > 0 ) { if ($agentId > 0 ) {
Log::info("手机号注册 - 开始获取客服列表...");
$customerIds = AdminModel::getCustomerIdsByAgentId($agentId); // 获取代理下的所有客服ID $customerIds = AdminModel::getCustomerIdsByAgentId($agentId); // 获取代理下的所有客服ID
Log::info("手机号注册 - 获取客服列表结果==".json_encode($customerIds));
if (empty($customerIds)) { if (empty($customerIds)) {
return $this->toData('500', lang('account_registration_failed')); return $this->toData('500', lang('account_registration_failed'));
} }
@ -599,6 +601,7 @@ class LoginService extends BaseHomeService
$tagIndex = $counterIndex % count($customerIds); $tagIndex = $counterIndex % count($customerIds);
$tagCustomerId = $customerIds[$tagIndex]; $tagCustomerId = $customerIds[$tagIndex];
} }
Log::info("手机号注册 - 或者最终绑定客服ID==".$tagCustomerId);
if ($tagCustomerId > 0) { if ($tagCustomerId > 0) {
$regUser->customer_id = $tagCustomerId; $regUser->customer_id = $tagCustomerId;
$regUser->save(); $regUser->save();

6
app/model/AdminModel.php

@ -87,7 +87,11 @@ class AdminModel extends BaseModel
if (empty($role)) { if (empty($role)) {
return 0; return 0;
} }
return $role->id; $agentId = self::where('role_id', $role->id)->find();
if (empty($agentId)) {
return 0;
}
return $agentId->id;
} }
// 根据代理ID获取其下属的所有客服ID (账号关系:代理 - 总监 - 组长 - 客服) // 根据代理ID获取其下属的所有客服ID (账号关系:代理 - 总监 - 组长 - 客服)

Loading…
Cancel
Save