123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- <?php namespace App\Http\Controllers\Api;
- use App\Models\CustomAmountRecord as CustomAmountRecord;
- use App\Models\CustomAmount as Model;
- /**
- * 用户余额接口
- *
- * @author jun
- *
- * */
- class CustomAmount extends Api{
-
-
- /**
- * 获取余额记录 /api/custom_amount/get_record_list
- *
- * @param string $code 授权码
- *
- * */
- public function get_record_list(Model $Model,CustomAmountRecord $CustomAmountRecord){
- // 接口验签
- // $this->verify_sign();
- // 检查登录
- $uid = $this->checkLogin();
- // 接收参数
- $limit = request('limit',15);
- // 查询条件
- $map = [['custom_uid','=',$uid],['status','=',1]];
- // 查询数据
- $Paginator = $CustomAmountRecord->query()->where($map)->orderByDesc('id')
- ->paginate($limit,['id','buy_type','pay_type','prefix','description','insert_time','pay_time','status','transfer_bill_no']);
- // 重置数据
- $list = [];
- // 获取数据
- $list['total'] = $Paginator->total();
- $list['current_page'] = $Paginator->currentPage();
- $list['per_page'] = $Paginator->perPage();
- $list['last_page'] = $Paginator->lastPage();
- $list['data'] = $Paginator->items();
- // 循环数据
- foreach ($list['data'] as $key => $value) {
- // 处理时间
- $value['pay_time'] = date('Y-m-d H:i:s',$value['pay_time']);
- $value['insert_time'] = date('Y-m-d H:i:s',$value['insert_time']);
- // 获取子列表
- $value['type_state'] = (string) $CustomAmountRecord->getPayType($value['buy_type'],$value['pay_type'],'name');
- if ($value['buy_type'] == 2 && $value['status'] == 1){
- $value['state'] = '提现中';
- }
- // 重组
- $list['data'][$key] = $value;
- }
- // 返回结果
- return json_send(['code'=>'success','msg'=>'获取成功','data'=>$list]);
- }
- }
|