BankBill.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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_popupshop_bank_logs>
  7. */
  8. namespace app\popupshop\model;
  9. use think\Model;
  10. use think\facade\Validate;
  11. class BankBill extends Model{
  12. protected $pk = 'id';
  13. protected $table = 'ai_popupshop_bank_bill';
  14. /**
  15. * 当前所属用户
  16. */
  17. public function user(){
  18. return $this->hasOne('app\common\model\SystemUser','id','user_id');
  19. }
  20. /**
  21. * 来源用户
  22. */
  23. public function formuser(){
  24. return $this->hasOne('app\common\model\SystemUser','id','from_uid');
  25. }
  26. /**
  27. * [log 增加财务日志]
  28. * @param [int] $uid [用户ID]
  29. * @param [float] $money [变动金额]
  30. * @param [str] $message [日志内容]
  31. * @param [boolean] $is_money[是积分还是钱]
  32. * @return [boolean] [增加成功ID]
  33. */
  34. public static function add(int $miniapp_id,int $uid,float $money,$message,int $from_uid = 0,string $order_no = ''){
  35. $data['member_miniapp_id'] = $miniapp_id;
  36. $data['user_id'] = $uid;
  37. $data['money'] = $money;
  38. $data['message'] = $message;
  39. $data['from_uid'] = $from_uid;
  40. $data['order_no'] = $order_no;
  41. $data['update_time'] = time();
  42. return self::insert($data);
  43. }
  44. }