FundBill.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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. * 采购基金账单
  7. */
  8. namespace app\allwin\model;
  9. use think\Model;
  10. use util\Util;
  11. class FundBill extends Model
  12. {
  13. protected $pk = 'id';
  14. protected $table = 'ai_allwin_fund_bill';
  15. public function user(){
  16. return $this->hasOne('app\common\model\SystemUser','id','uid');
  17. }
  18. /**
  19. * 后台在使用
  20. * 收益记录
  21. */
  22. public static function bill($where){
  23. return self::where($where)->order('id desc')->paginate(20,false,['query'=>['input' =>$where['user_id']]]);
  24. }
  25. /**
  26. * [log 增加财务日志]
  27. * @param [array] $param
  28. */
  29. public static function add(array $param){
  30. $data['member_miniapp_id'] = intval($param['miniapp_id']);
  31. $data['store_id'] = intval($param['store_id']);
  32. $data['types'] = intval($param['types']);
  33. $data['uid'] = intval($param['uid']);
  34. $data['order_no'] = $param['order_no'];
  35. $data['money'] = floatval($param['money']);
  36. $data['update_time'] = time();
  37. return self::insert($data);
  38. }
  39. }