| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- <?php
- namespace app\v1\logic\center;
- use plugin\saiadmin\basic\BaseLogic;
- use plugin\saiadmin\exception\ApiException;
- use plugin\saiadmin\utils\Helper;
- use app\v1\model\center\GamePayChannel;
- use support\think\Db;
- /**
- * 游戏支付渠道逻辑层
- */
- class GamePayChannelLogic extends BaseLogic
- {
- /**
- * 构造函数
- */
- public function __construct()
- {
- $this->model = new GamePayChannel();
- }
- /**
- * 获取支付主体
- * @return array
- */
- public function getPaySubject()
- {
- return Db::connect('db_center')->name('pay_channel')->hidden(['config'])->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();
- }
- }
|