Explorar o código

游戏支付渠道添加,判断是否存在游戏了

ith5 hai 5 meses
pai
achega
2b0c044fda
Modificáronse 1 ficheiros con 19 adicións e 0 borrados
  1. 19 0
      app/v1/logic/center/GamePayChannelLogic.php

+ 19 - 0
app/v1/logic/center/GamePayChannelLogic.php

@@ -30,4 +30,23 @@ class GamePayChannelLogic extends BaseLogic
         return Db::connect('db_center')->name('pay_channel')->where('status', 1)->select()->toArray();
     }
 
+
+    /**
+     * 添加数据
+     * @param $data
+     * @return mixed
+     */
+    public function add($data): mixed
+    {
+        $gameId = $data['game_id'];
+        $result =$this->model->where('game_id',$gameId)->select();
+       
+        if($result->isEmpty()){
+            $this->model->save($data);
+        }else{
+            throw new ApiException('该游戏支付渠道已存在');
+        }
+         return $this->model->getKey();
+    }
+
 }