1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- <?php
- /**
- * IntegralActivityModel.php UTF-8
- *
- *
- * @date : 2018/5/5 14:17
- *
- * @license 这不是一个自由软件,未经授权不许任何使用和传播。
- * @author : wuyonghong <wyh@huosdk.com>
- * @version : HUOSDK 8.0
- */
- namespace huo\model\integral;
- use huo\model\common\CommonModel;
- class IntegralActivityModel extends CommonModel {
- protected $name = 'itg_act';
- // 开启自动写入时间戳字段
- protected $autoWriteTimestamp = true;
- /**
- * 基础查询
- *
- * @param $query
- */
- protected function base($query) {
- $query->where('delete_time', 0)
- ->where('is_delete', 2);
- }
- /**
- * 添加积分活动
- *
- * @param $data
- *
- * @return bool|mixed
- */
- public function addIa($data) {
- if (empty($data)) {
- return false;
- }
- if ($_obj = self::create($data, true)) {
- return $_obj->id;
- } else {
- return false;
- }
- }
- /**
- * 获取积分活动
- *
- * @param array $where
- *
- * @return array|false|\PDOStatement|string|\think\Collection
- */
- public function getIas($where = []) {
- $_field
- = 'id,ia_code,ia_name,icon,ia_desc,integral,link_table,start_time,end_time,limit_agent,list_order,limit_cnt,type';
- $_data = $this->where($where)->order('list_order desc, id asc')->column($_field, 'id');
- return $_data;
- }
- /**
- * 更新积分活动
- *
- * @param array $ia_data
- * @param int $ia_id
- *
- * @return bool
- */
- public function updateIa($ia_data, $ia_id) {
- $_map['id'] = $ia_id;
- $_data = $ia_data;
- $_rs = self::update($_data, $_map, true);
- if (false == $_rs) {
- return false;
- } else {
- return true;
- }
- }
- }
|