| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 | <?php/** * PromotiondownlogModel.php  UTF-8 * 投放平台管理 * * @date    : 2018/7/26 21:41 * * @license 这不是一个自由软件,未经授权不许任何使用和传播。 * @author  : guxiannong <gxn@huosdk.com> * @version : HUOSDK 8.0 */namespace huo\model\distribution;use huo\model\common\CommonModel;class PromotiondownlogModel extends CommonModel {    protected $name = 'promotion_down_log';    // 开启自动写入时间戳字段    protected $autoWriteTimestamp = true;    public function updateData($gmh_data, $_map = null) {        $_data = $gmh_data;        $_data['update_time'] = time();        $_rs = self::update($_data, $_map, true);        if (false == $_rs) {            return false;        } else {            return true;        }    }    /**     * 获取单条记录     *     * @param int  $id     *     * @param bool $base     *     * @return array|false     * @throws \think\Exception     * @throws \think\db\exception\DataNotFoundException     * @throws \think\db\exception\ModelNotFoundException     * @throws \think\exception\DbException     */    public function getInfoById($id, $base = true) {        $_map['id'] = $id;        $_info = $this->useGlobalScope($base)->where($_map)->find();        if (false === $_info) {            return false;        }        if (is_object($_info)) {            return $_info->toArray();        } else {            return $_info;        }    }    /**     * 添加一条记录     *     * @param $data     *     * @return bool|mixed     */    public function addData($data) {        if (empty($data)) {            return false;        }        $_obj = self::create($data, true);        if (false == $_obj) {            return false;        }        return $_obj->id;    }    /**     *   字段对应表     *     * @param array  $where     * @param string $_field     *     * @return array     * @internal param bool $inc_nice     *     */    public function getIdValues($where, $_field = 'domain') {        $_platforms = $this->where($where)                           ->column($_field, 'id');        return $_platforms;    }}
 |