123456789101112131415161718192021222324252627282930313233343536373839404142 |
- <?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 AllwinUnmarketVerif extends Model{
- protected $pk = 'id';
-
- //和主用户表绑定关系
- public function user(){
- return $this->hasOne('app\common\model\SystemUser','id','uid');
- }
- //获得主表
- public function store(){
- return $this->hasOne('AllwinUnmarketStore','id','store_id');
- }
- //添加或编辑
- public static function edit(array $param){
- $data = [
- 'uid' => trim($param['uid']),
- 'union_id' => trim($param['union_id']),
- 'store_id' => trim($param['store_id']),
- 'times' => strtotime($param['times']),
- ];
- 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);
- }
- }
- }
|