SmartbcStoreBill.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2017 https://www.sapixx.com All rights reserved.
  4. * @license Licensed (http://www.apache.org/licenses/LICENSE-2.0).
  5. * @author pillar<ltmn@qq.com>
  6. * 好店收入日志 Table<ai_smartbc_store_bill>
  7. */
  8. namespace app\smartbc\model;
  9. use think\Model;
  10. class SmartbcStoreBill extends Model{
  11. public function user(){
  12. return $this->hasOne('app\common\model\SystemUser','id','pay_uid');
  13. }
  14. /**
  15. * 后台在使用
  16. * 收益记录
  17. */
  18. public static function bill($where){
  19. return self::where($where)->order('id desc')->paginate(20,false,['query'=>['input' =>$where['user_id']]]);
  20. }
  21. /**
  22. * [log 增加财务日志]
  23. * @param [array] $param['miniapp_id = '1',uid=>'1',store_id=>'1','pay_uid' => 0]
  24. * @return [boolean] [增加成功ID]
  25. */
  26. public static function add(array $param,$message){
  27. $data['member_miniapp_id'] = intval($param['member_miniapp_id']);
  28. $data['store_id'] = intval($param['store_id']);
  29. $data['pay_uid'] = intval($param['pay_uid']);
  30. $data['store_chain_id'] = intval($param['store_chain_id']);
  31. $data['money'] = floatval($param['money']);
  32. $data['message'] = $message;
  33. $data['update_time'] = time();
  34. return self::insert($data);
  35. }
  36. }