123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- <?php
- /**
- * ChannelLogic.php UTF-8
- * CPS平台逻辑
- *
- * @date : 2018/7/27 14:11
- *
- * @license 这不是一个自由软件,未经授权不许任何使用和传播。
- * @author : chenbingling <cbl@huosdk.com>
- * @version : HUOSDK 8.0
- */
- namespace huo\logic\game;
- use huo\model\common\CommonModel;
- use huo\model\game\ChannelModel;
- class ChannelLogic extends CommonModel {
- /**
- * 获取CPS平台列表
- *
- * @param array $map
- * @param string $order
- * @param int $offset
- *
- * @return \think\Paginator
- * @throws \think\exception\DbException
- */
- public function getChannelList($map = [], $order = 'id desc', $offset = 10) {
- $field = 'id, channel_name, company_name, link_man, mobile, position, create_time, update_time';
- $_items = (new ChannelModel())->field($field)->where($map)->order($order)->paginate($offset);
- return $_items;
- }
- /**
- * 获取CP名称列表
- *
- * @return array
- */
- public static function getNamesById() {
- $_arr = (new ChannelModel())->where('is_delete', 2)->order('id desc')->column('channel_name name', 'id');
- return $_arr;
- }
- /***
- * 添加cp
- *
- * @param $param
- *
- * @param bool $return_id
- *
- * @return false|int
- */
- public function addChannel($param, $return_id = false) {
- $_model = (new ChannelModel());
- $_rs = $_model->allowField(true)->save($param);
- if (true == $return_id) {
- return $_model->id;
- }
- return $_rs;
- }
- /**
- * @param $id
- *
- * @return array|false|\PDOStatement|string|\think\Model
- * @throws \think\db\exception\DataNotFoundException
- * @throws \think\db\exception\ModelNotFoundException
- * @throws \think\exception\DbException
- */
- public function getChannelById($id) {
- $_rs = (new ChannelModel())->where('id', $id)->find();
- return $_rs;
- }
- public function updateChannel($id, $param) {
- $_rs = (new ChannelModel())->allowField(true)->save($param, ['id' => $id]);
- return $_rs;
- }
- }
|