123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107 |
- <?php
- namespace app\common\model;
- use think\facade\Db;
- class Pmgdiscountquota extends BaseModel {
- public $page_info;
-
- public function getMgdiscountquotaList($condition, $pagesize = null, $order = '', $field = '*') {
- if($pagesize){
- $res = Db::name('pmgdiscountquota')->field($field)->where($condition)->order($order)->paginate(['list_rows'=>$pagesize,'query' => request()->param()],false);
- $this->page_info = $res;
- $result = $res->items();
- }else{
- $result = Db::name('pmgdiscountquota')->field($field)->where($condition)->order($order)->select()->toArray();
- }
- return $result;
- }
-
- public function getMgdiscountquotaInfo($condition) {
- $result = Db::name('pmgdiscountquota')->where($condition)->find();
- return $result;
- }
-
- public function getMgdiscountquotaCurrent($store_id) {
- $condition = array();
- $condition[] = array('store_id', '=', $store_id);
- $condition[] = array('mgdiscountquota_endtime', '>', TIMESTAMP);
- return $this->getMgdiscountquotaInfo($condition);
- }
-
- public function addMgdiscountquota($data) {
- return Db::name('pmgdiscountquota')->insertGetId($data);
- }
-
- public function editMgdiscountquota($update, $condition) {
- return Db::name('pmgdiscountquota')->where($condition)->update($update);
- }
-
- public function delMgdiscountquota($condition) {
- return Db::name('pmgdiscountquota')->where($condition)->delete();
- }
- }
|