|
@@ -25,7 +25,7 @@ class Platform extends Base
|
|
|
|
|
|
$val = Validate::rule([
|
|
|
'platform_name|平台名称' => 'require|max:255',
|
|
|
- 'platform_type|对接平台' => 'require|number|in:0,1',
|
|
|
+ 'platform_type|对接平台' => 'require|number|in:0,1,2',
|
|
|
'use_type|对接类型' => 'require|number|in:0,1,2',
|
|
|
'is_select_pay_rate|是否开启支付渠道' => 'require|number|in:0,1',
|
|
|
'desc|描述' => 'max:255',
|
|
@@ -201,7 +201,7 @@ class Platform extends Base
|
|
|
$val = Validate::rule([
|
|
|
'id' => 'require|number|gt:0',
|
|
|
'platform_name|平台名称' => 'require|max:255',
|
|
|
- 'platform_type|对接平台' => 'require|number|in:0,1',
|
|
|
+ 'platform_type|对接平台' => 'require|number|in:0,1,2',
|
|
|
'use_type|对接类型' => 'require|number|in:0,1,2',
|
|
|
'is_select_pay_rate|是否开启支付渠道' => 'require|number|in:0,1',
|
|
|
'desc|描述' => 'max:255',
|
|
@@ -305,10 +305,6 @@ class Platform extends Base
|
|
|
{
|
|
|
|
|
|
$id = $this->request->filter('trim')->post('id/d', 0);
|
|
|
-// $id = isset($this->post['id']) && $this->post['id'] !=="" ? trim($this->post['id']) :"";
|
|
|
-// if($id==""){
|
|
|
-// return error_show(1002,"参数id不能为空");
|
|
|
-// }
|
|
|
$info = Db::name('platform')
|
|
|
->where(['id' => $id, 'is_del' => 0])
|
|
|
->find();
|
|
@@ -330,24 +326,6 @@ class Platform extends Base
|
|
|
{
|
|
|
$id = $this->request->filter('trim')->post('id/d', 0);
|
|
|
|
|
|
-// $id = isset($this->post['id']) && $this->post['id'] !==""? intval($this->post['id']):"";
|
|
|
-// if($id==""){
|
|
|
-// return error_show(1002,"参数id不能为空");
|
|
|
-// }
|
|
|
-// $info = Db::name("platform")->where(['id'=>$id,'is_del'=>0])->find();
|
|
|
-// if(empty($info)){
|
|
|
-// return error_show(1002,"未找到数据");
|
|
|
-// }
|
|
|
-// $end = Db::name('platform')
|
|
|
-// ->where(['id'=>$id,'is_del'=>0])
|
|
|
-// ->update(['is_del'=>1,'updatetime'=>date("Y-m-d H:i:s")]);
|
|
|
-// if($end){
|
|
|
-// return $end?app_show(0,"删除成功"):error_show(1002,"删除失败");
|
|
|
-// }else{
|
|
|
-// return error_show(1002,"删除失败");
|
|
|
-// }
|
|
|
-
|
|
|
-
|
|
|
Db::startTrans();
|
|
|
|
|
|
try {
|
|
@@ -358,18 +336,8 @@ class Platform extends Base
|
|
|
'is_del' => 1,
|
|
|
'updatetime' => date("Y-m-d H:i:s"),
|
|
|
]);
|
|
|
-
|
|
|
if ($rs == 0) throw new Exception('该平台不存在');
|
|
|
-
|
|
|
-// Db::name('platform_pay_rate')
|
|
|
-// ->where(['is_del' => 0, 'platform_id' => $id])
|
|
|
-// ->update([
|
|
|
-// 'is_del' => 1,
|
|
|
-// 'updatetime' => date("Y-m-d H:i:s"),
|
|
|
-// ]);
|
|
|
-
|
|
|
Db::commit();
|
|
|
-
|
|
|
return json_show(0, '删除成功');
|
|
|
} catch (Exception $exception) {
|
|
|
Db::rollback();
|
|
@@ -390,24 +358,6 @@ class Platform extends Base
|
|
|
]);
|
|
|
|
|
|
if ($val->check($param) == false) return json_show(1004, $val->getError());
|
|
|
-
|
|
|
-// $id = isset($this->post['id']) && $this->post['id'] !=="" ? intval($this->post['id']):"";
|
|
|
-// if($id==""){
|
|
|
-// return error_show(1002,"参数id不能为空");
|
|
|
-// }
|
|
|
-// $info = Db::name("platform")->where(['id'=>$id,'is_del'=>0])->find();
|
|
|
-// if(empty($info)){
|
|
|
-// return error_show(1002,"未找到数据");
|
|
|
-// }
|
|
|
-// $status = isset($this->post['status']) && $this->post['status'] !==""? intval($this->post['status']):"";
|
|
|
-// if($status===""){
|
|
|
-// return error_show(1002,"参数status不能为空");
|
|
|
-// }
|
|
|
-// if(!in_array($status,[0,1])){
|
|
|
-// return error_show(1002,"参数status无效");
|
|
|
-// }
|
|
|
-
|
|
|
-
|
|
|
Db::startTrans();
|
|
|
|
|
|
try {
|
|
@@ -421,15 +371,6 @@ class Platform extends Base
|
|
|
]);
|
|
|
|
|
|
if ($rs == 0) throw new Exception('该平台不存在或重复操作');
|
|
|
-
|
|
|
-// Db::name('platform_pay_rate')
|
|
|
-// ->where(['is_del' => 0, 'platform_id' => $param['id']])
|
|
|
-// ->where('status', '<>', $param['status'])
|
|
|
-// ->update([
|
|
|
-// 'status' => $param['status'],
|
|
|
-// 'updatetime' => date("Y-m-d H:i:s"),
|
|
|
-// ]);
|
|
|
-
|
|
|
Db::commit();
|
|
|
|
|
|
return json_show(0, '操作成功');
|
|
@@ -437,14 +378,7 @@ class Platform extends Base
|
|
|
Db::rollback();
|
|
|
return json_show(1004, '操作失败,' . $exception->getMessage());
|
|
|
}
|
|
|
-
|
|
|
-// $info['status']=$status;
|
|
|
-// $info['updatetime']=date("Y-m-d H:i:s");
|
|
|
-// $msg = $status==1?"启用":"禁用";
|
|
|
-// $update = Db::name("platform")->save($info);
|
|
|
-// return $update? error_show(0,"{$msg}成功"):error_show(1004,"{$msg}失败");
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
|
|
|
/** 平台添加分类 **/
|
|
@@ -458,23 +392,10 @@ class Platform extends Base
|
|
|
$cat = Db::name("cat")
|
|
|
->where(["status" => 1, "is_del" => 0])
|
|
|
->cursor();
|
|
|
-// if (empty($cat)){
|
|
|
-// return '';
|
|
|
-// }
|
|
|
|
|
|
$insert_data = [];
|
|
|
$date = date("Y-m-d H:i:s");
|
|
|
foreach ($cat as $value) {
|
|
|
-// $temp=[];
|
|
|
-// $temp['cat_id']=$value['id'];
|
|
|
-// $temp['platform_id']=$plat_id;
|
|
|
-// $temp['fund_code']=$value['fund_code'];
|
|
|
-// $temp['status']=$value['status'];
|
|
|
-// $temp['apply_id']=$value['createrid'];
|
|
|
-// $temp['apply_name']=$value['creater'];
|
|
|
-// $temp['addtime']=date("Y-m-d H:i:s");
|
|
|
-// $temp['updatetime']=date("Y-m-d H:i:s");
|
|
|
-
|
|
|
$temp = [
|
|
|
'cat_id' => $value['id'],
|
|
|
'platform_id' => $plat_id,
|
|
@@ -485,12 +406,8 @@ class Platform extends Base
|
|
|
'addtime' => $date,
|
|
|
'updatetime' => $date,
|
|
|
];
|
|
|
-
|
|
|
-// $isT = Db::name("cat_plat")
|
|
|
-// ->where(["cat_id"=>$value['id'],"platform_id"=>$plat_id,"is_del"=>0])
|
|
|
-// ->find();
|
|
|
+
|
|
|
if (isset($tmp[$value['id']])) {
|
|
|
-// $data= $temp;
|
|
|
unset($temp['cat_id']);
|
|
|
unset($temp['addtime']);
|
|
|
Db::name("cat_plat")
|