| 123456789101112131415161718192021222324252627282930313233343536373839404142434445 | 
							- <?php
 
- /**
 
-  * @copyright   Copyright (c) 2017 https://www.sapixx.com All rights reserved.
 
-  * @license     Licensed (http://www.apache.org/licenses/LICENSE-2.0).
 
-  * @author      pillar<ltmn@qq.com>
 
-  * 支付有礼
 
-  */
 
- namespace app\allwin\model;
 
- use think\Model;
 
- class AllwinGift extends Model{
 
-     protected $pk = 'id';
 
-     
 
-     //赠送优惠券
 
-     public function coupon(){
 
-         return $this->hasOne('Coupon','id','coupon_id');
 
-     }
 
-     //添加或编辑
 
-     public static function edit(array $param){
 
-         $data = [
 
-             'types'             => $param['types'],
 
-             'pay_num'           => $param['pay_num'],
 
-             'pay_amount'        => $param['pay_amount'],
 
-             'coupon_id'         => $param['coupon_id'],
 
-             'title'             => $param['title'],
 
-             'share_img'         => $param['share_img'],
 
-             'share_title'       => $param['share_title'],
 
-             'share_text'        => $param['share_text'],
 
-             'note'              => $param['note'],
 
-             'start_time'        => strtotime($param['start_time']),
 
-             'end_time'          => strtotime($param['end_time']),
 
-         ];
 
-         if(isset($param['id'])){
 
-             $condition['id']                = $param['id'];
 
-             $condition['member_miniapp_id'] = $param['member_miniapp_id'];
 
-             return self::where($condition)->update($data);
 
-         }else{
 
-             $data['member_miniapp_id'] = $param['member_miniapp_id'];
 
-             return self::insert($data);
 
-         }
 
-     }
 
- }
 
 
  |