feat: 【小程序】debug
This commit is contained in:
parent
04f8580ced
commit
5aec64598f
18
application/common/model/DebugLog.php
Normal file
18
application/common/model/DebugLog.php
Normal file
|
|
@ -0,0 +1,18 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\common\model;
|
||||||
|
|
||||||
|
use think\Model;
|
||||||
|
|
||||||
|
class DebugLog extends Model
|
||||||
|
{
|
||||||
|
protected $visible = [
|
||||||
|
|
||||||
|
];
|
||||||
|
|
||||||
|
protected $hidden = [
|
||||||
|
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -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%}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
17
application/services/DebugLogService.php
Normal file
17
application/services/DebugLogService.php
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -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);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user