Accept Merge Request #215: (feature/dgg -> develop)

Merge Request: feat: 【小程序】debug

Created By: @大狗哥
Accepted By: @大狗哥
URL: https://g-bcrc3009.coding.net/p/allocatr/d/allocatr/git/merge/215?initial=true
This commit is contained in:
大狗哥 2025-07-03 15:01:26 +08:00 committed by Coding
commit 53fa5d7932
4 changed files with 58 additions and 0 deletions

View File

@ -0,0 +1,18 @@
<?php
namespace app\common\model;
use think\Model;
class DebugLog extends Model
{
protected $visible = [
];
protected $hidden = [
];
}

View File

@ -13,6 +13,7 @@ use app\common\model\OrderDispatch;
use app\common\model\Order; use app\common\model\Order;
use app\common\model\Abnormal; use app\common\model\Abnormal;
use app\common\model\OrderAbnormal; use app\common\model\OrderAbnormal;
use app\common\model\DebugLog;
//{%add use model%} //{%add use model%}
class BaseService class BaseService
@ -144,5 +145,21 @@ class BaseService
return app(OrderAbnormal::class, true); return app(OrderAbnormal::class, true);
} }
/**
* @return DebugLogService
*/
protected function getDebugLogService()
{
return app(DebugLogService::class);
}
/**
* @return DebugLog
*/
protected function getDebugLogModel()
{
return app(DebugLog::class, true);
}
//{%add function code%} //{%add function code%}
} }

View File

@ -0,0 +1,17 @@
<?php
namespace app\services;
class DebugLogService extends BaseService
{
public function create(string $title, string $content)
{
$model = $this->getDebugLogModel();
$model->title = $title;
$model->content = $content;
$model->create_time = datetime(time());
$model->save();
return true;
}
}

View File

@ -16,6 +16,12 @@ class WorkerService extends BaseService
{ {
$phone = $this->getPhoneNumber($code); $phone = $this->getPhoneNumber($code);
$worker = $this->getWorkerService()->getByTel($phone); $worker = $this->getWorkerService()->getByTel($phone);
// debug
if (empty($worker)) {
$this->getDebugLogService()->create('小程序登录没通过手机号找到师傅', "手机号:$phone");
}
$this->tryBindPhoneNumber($worker); $this->tryBindPhoneNumber($worker);
$tokenData = Token::get($vendorToken); $tokenData = Token::get($vendorToken);