1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- <?php
- namespace app\store\model;
- use app\common\model\XcxHomeSetting as XcxHomeSettingModel;
- /**
- * 渠道销售统计模型
- * @package app\store\model
- */
- class XcxHomeSetting extends XcxHomeSettingModel
- {
- public static function openPage($id,$params){
- return static::where('id',$id)->update($params);
- }
- public function getStartTimeAttr($data){
- if ($data > 0){
- return date('Y-m-d H:i:s',$data);
- }
- return '';
- }
- public function getEndTimeAttr($data){
- if ($data > 0){
- return date('Y-m-d H:i:s',$data);
- }
- return '';
- }
- public static function lists()
- {
- $data = static::where('is_delete',0)->where('home_type',1)
- ->field('id,home_type,start_time,end_time,open_status')->find();
- if ($data && strtotime($data['start_time']) < time() && strtotime($data['end_time']) > time() && $data['open_status'] == 1){
- $data['real_open_status'] = 1;
- }else{
- $data['real_open_status'] = 0;
- }
- return ['act'=>$data];
- }
- public static function settingUpdate($settings){
- return static::where('id',1)->where('home_type',1)
- ->update(['setting'=>$settings]);
- }
- public function getSettingAttr($data){
- if ($data){
- return json_decode($data);
- }
- return null;
- }
- public static function getPage(){
- return self::where(['home_type'=>1])
- ->field('id,home_type,setting,file_id,open_status')
- ->find();
- }
- }
|