40 lines
683 B
PHP
40 lines
683 B
PHP
<?php
|
|
|
|
namespace app\services;
|
|
|
|
use app\api\library\ApiException;
|
|
use app\common\model\Worker;
|
|
use think\Log;
|
|
|
|
//{%add use model%}
|
|
|
|
class BaseService
|
|
{
|
|
protected function apiError($msg, $code = 0, $data = [])
|
|
{
|
|
if (!empty($data)) {
|
|
array_unshift($data, $msg);
|
|
Log::log($data);
|
|
}
|
|
|
|
throw new ApiException($msg, $code);
|
|
}
|
|
/**
|
|
* @return WorkerService
|
|
*/
|
|
protected function getWorkerService()
|
|
{
|
|
return app(WorkerService::class);
|
|
}
|
|
|
|
/**
|
|
* @return Worker
|
|
*/
|
|
protected function getWorkerModel()
|
|
{
|
|
return app(Worker::class, true);
|
|
}
|
|
|
|
//{%add function code%}
|
|
}
|