PaymentModel.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. namespace app\common\model;
  3. use app\api\services\UserServices;
  4. use app\common\model\TimeModel;
  5. //use app\model\RedPoolModel;
  6. //use app\model\RedStorePoolModel;
  7. use app\common\model\UserDataModel;
  8. use think\Exception;
  9. use think\facade\Db;
  10. use think\Model;
  11. class PaymentModel extends Model
  12. {
  13. protected $name = "payment";
  14. /**
  15. * 消费记录
  16. * @param $param
  17. * @return array
  18. * @throws \think\db\exception\DbException
  19. */
  20. public function getLog ($param, $type = 0)
  21. {
  22. $where = [];
  23. $where[] = ['order_type', '=', 4];
  24. $where[] = ['state', '=', 6];
  25. $list = self::where('uid', $param->uid)
  26. ->where($where)
  27. ->withAttr('creat_at', function ($val, $data){
  28. return sr_getcurtime(strtotime($val), 'Y-m-d');
  29. })
  30. ->order('id', 'desc')
  31. ->field('id,total_fee,creat_at')
  32. ->paginate($param->data['limit'])
  33. ->toArray();
  34. foreach ($list['data'] as $key=>&$val){
  35. $val['type'] = '购买商品';
  36. }
  37. return $list['data'];
  38. }
  39. }