| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- <?php
- // +----------------------------------------------------------------------
- // | LARAVEL8.0 框架 [ LARAVEL ][ RXThinkCMF ]
- // +----------------------------------------------------------------------
- // | 版权所有 2017~2021 LARAVEL研发中心
- // +----------------------------------------------------------------------
- // | 官方网站: http://www.laravel.cn
- // +----------------------------------------------------------------------
- // | Author: laravel开发员 <laravel.qq.com>
- // +----------------------------------------------------------------------
- namespace App\Services\Common;
- use App\Models\AdModel;
- use App\Models\ApiModel;
- use App\Services\BaseService;
- /**
- * 接口管理-服务类
- * Class ApiService
- * @package App\Services\Common
- */
- class ApiService extends BaseService
- {
- // 静态对象
- protected static $instance = null;
- /**
- * 构造函数
- * ApiService constructor.
- */
- public function __construct()
- {
- $this->model = new ApiModel();
- }
- /**
- * 静态入口
- * @return static|null
- */
- public static function make()
- {
- if (!self::$instance) {
- self::$instance = (new static());
- }
- return self::$instance;
- }
- /**
- * 添加或编辑
- * @return array
- */
- public function saveData($adminId, $data)
- {
- $data['admin_id'] = $adminId;
- // 权限
- if ($data['user_limits']) {
- $data['user_limits'] = array_filter($data['user_limits']);
- $data['user_limits'] = $data['user_limits']? implode(',', $data['user_limits']) : '';
- }
- // 结束时间
- $id = isset($data['id'])? $data['id'] : 0;
- if (!$id) {
- $data['api_key'] = getCode('Ti', 12);
- }
- return parent::edit($data); // TODO: Change the autogenerated stub
- }
- }
|