You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
68 lines
2.1 KiB
68 lines
2.1 KiB
<?php
|
|
// +----------------------------------------------------------------------
|
|
// | Niucloud-admin 企业快速开发的多应用管理平台
|
|
// +----------------------------------------------------------------------
|
|
// | 官方网址:https://www.niucloud.com
|
|
// +----------------------------------------------------------------------
|
|
// | niucloud团队 版权所有 开源版本可自由商用
|
|
// +----------------------------------------------------------------------
|
|
// | Author: Niucloud Team
|
|
// +----------------------------------------------------------------------
|
|
|
|
namespace app\service\api\apiService;
|
|
|
|
use app\model\customer_resources\CustomerResources;
|
|
use app\model\six_speed\SixSpeed;
|
|
use core\base\BaseApiService;
|
|
use think\facade\Db;
|
|
|
|
/**
|
|
* 客户资源服务层
|
|
* Class MemberService
|
|
* @package app\service\api\member
|
|
*/
|
|
class CustomerResourcesService extends BaseApiService
|
|
{
|
|
public function __construct()
|
|
{
|
|
parent::__construct();
|
|
}
|
|
|
|
//添加数据
|
|
public function addData(array $customer_resources_data,array $six_speed_data){
|
|
$date = date('Y-m-d H:i:s');
|
|
$customer_resources_data['updated_at'] = $date;
|
|
$six_speed_data['updated_at'] = $date;
|
|
|
|
$res = [
|
|
'code'=>0,
|
|
'msg'=>'操作失败'
|
|
];
|
|
//开启事物
|
|
Db::startTrans();
|
|
try {
|
|
$resource_id = CustomerResources::insertGetId($customer_resources_data);//客户资源表
|
|
if(!$resource_id){
|
|
Db::rollback();
|
|
return $res;
|
|
}
|
|
$six_speed_data['resource_id'] = $resource_id;
|
|
$sixSpeedAdd = SixSpeed::create($six_speed_data);
|
|
if(!$sixSpeedAdd){
|
|
Db::rollback();
|
|
return $res;
|
|
}
|
|
Db::commit();
|
|
$res = [
|
|
'code'=>1,
|
|
'msg'=>'操作成功'
|
|
];
|
|
//@todo 缺少一个事件 应补上去查询config事件
|
|
return $res;
|
|
}catch (\Exception $exception){
|
|
Db::rollback();
|
|
return $res;
|
|
}
|
|
}
|
|
|
|
}
|
|
|