123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- <?php
- namespace App\Http\Controllers\MoneyDetail\Front;
- use App\Http\Controllers\FrontController;
- use App\Models\MoneyDetail;
- use App\Models\MoneyDetails;
- use App\Servers\MoneyDetailServer;
- use Carbon\Carbon;
- use Illuminate\Support\Facades\Auth;
- class MoneyDetailsController extends FrontController
- {
- public function __construct()
- {
- parent::__construct();
- }
- /**
- * @param int $size
- * @return \Illuminate\Http\JsonResponse
- *
- * 货币
- */
- public function index($size = 20)
- {
- $status=request()->input('status','0');
- $type = request()->input('coin_id', 1);
- if($status==2 && $type==3){
- $status=[5,6,7,11,12,13,21];
- }else{
- $status=['1',2,3,4,8,9,10,14,15,20,22];
- }
- $details = MoneyDetails::where('type', $type)
- ->whereIn('status', $status)
- ->where('member_id', $this->member->{'id'})
- ->orderBy('id', 'desc')
- ->paginate($size);
- $data = array();
- foreach ($details as $key => $detail) {
- if ($detail->add_reduce == 2) {
- $data[$key]['price'] = -$detail->price; // 转出数目
- } else {
- $data[$key]['price'] = $detail->price; // 转出数目
- }
- $data[$key]['remainder'] = $detail->remainder; // 余
- $data[$key]['id'] = $detail->id; // 余
- if (request()->input('lang', 'zh') == 'zh') {
- $data[$key]['mark'] = $detail->mark; // 明细
- $data[$key]['status_str'] = MoneyDetailServer::$status_map[$detail->status];
- } else {
- $data[$key]['mark'] = $detail->mark_en; // 明细
- $data[$key]['status_str'] = MoneyDetailServer::$status_map_en[$detail->status];
- }
- $data[$key]['created_at'] = Carbon::parse($detail->created_at, config('app.timezone'))->format('Y/m/d H:i'); // 时间
- }
- return $this->apiResponseSuccess($data, 'member.yes');
- }
- /**
- * 获取明细详情
- * @return \Illuminate\Http\JsonResponse
- */
- function info()
- {
- $id = request()->input('id',1);
- // withdraw_config
- $details = MoneyDetails::where('id', $id)->first()->toArray();
- $details['coin_name'] = MoneyDetailServer::$type_map[$details['type']];
- if (request()->input('lang', 'zh') == 'zh') {
- $details['status_str'] = MoneyDetailServer::$status_map[$details['status']];
- } else {
- $details['mark'] = $details['mark_en'] ; // 明细
- $details['status_str'] = MoneyDetailServer::$status_map_en[$details['status']];
- }
- return $this->apiResponseSuccess($details, 'member.yes');
- }
- }
|