<?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>
 * 好店收入日志 Table<ai_ais_store_bill>
 */
namespace app\ais\model;
use think\Model;

class AisStoreBill extends Model{
    
    public function user(){
        return $this->hasOne('app\common\model\SystemUser','id','pay_uid');
    } 

 
   /**
     * [log 增加财务日志]
     * @param  [array]  $param['miniapp_id = '1',uid=>'1',store_id=>'1','pay_uid' => 0]
     * @return [boolean]          [增加成功ID]
     */
    public static function add(array $param,$message){
        $data['member_miniapp_id'] = intval($param['member_miniapp_id']);
        $data['store_id']          = intval($param['store_id']);
        $data['pay_uid']           = intval($param['pay_uid']);
        $data['store_chain_id']    = intval($param['store_chain_id']);
        $data['money']             = floatval($param['money']);
        $data['message']           = $message;
        $data['update_time']       = time();
        return self::insert($data);
    }
}