BankBill.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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_allwin_bank_bill>
  7. */
  8. namespace app\allwin\model;
  9. use think\Model;
  10. use think\facade\Validate;
  11. class BankBill extends Model{
  12. protected $pk = 'id';
  13. protected $table = 'ai_allwin_bank_bill';
  14. public function user(){
  15. return $this->hasOne('app\common\model\SystemUser','id','pay_uid');
  16. }
  17. /**
  18. * 后台在使用
  19. * 收益记录
  20. */
  21. public static function bill($where){
  22. return self::where($where)->order('id desc')->paginate(20,false,['query'=>['uid' =>$where['user_id']]]);
  23. }
  24. /**
  25. * [log 增加财务日志]
  26. * @param [array] $param['miniapp_id = '1'',uid=>'1',store_id=>'1','pay_uid' => 0]
  27. * @return [boolean] [增加成功ID]
  28. */
  29. public static function add(array $param,$message){
  30. $data['member_miniapp_id'] = intval($param['miniapp_id']);
  31. $data['user_id'] = intval($param['uid']);
  32. $data['store_id'] = intval($param['store_id']);
  33. $data['pay_uid'] = intval($param['pay_uid']);
  34. $data['money'] = money($param['money']);
  35. $data['message'] = $message;
  36. $data['update_time'] = time();
  37. return self::create($data);
  38. }
  39. }