param_data; try { Validator::input($param, [ 'page' => Validator::notEmpty()->intType()->setName('页面'), 'limit' => Validator::notEmpty()->intType()->setName('输出条数'), ]); $data = Db::table('wa_my_goods') ->where('user_id', $request->user_data['id']) ->where(function ($query) use ($param) { if (Arr::get($param, 'type')) { $query->where('type', $param['type']); } }) ->orderByDesc('id') ->paginate(Arr::get($param, 'limit', 10), ['*'], 'page', Arr::get($param, 'page')) ->toArray(); $arr = []; foreach ($data['data'] as $k => $v) { $wa_goods = Db::table('wa_goods')->where('id', $v->goods_id)->first(); $arr[] = [ 'good_name' => $wa_goods->name, 'pay_price' => $wa_goods->pay_price, 'bonus' => $wa_goods->bonus, 'balance' => $wa_goods->balance, 'gift_money' => $wa_goods->gift_money, 'daily_limit' => $wa_goods->daily_limit, 'monthly_limit' => $wa_goods->monthly_limit, 'img' => imageToBase64($wa_goods->img), 'created_at' => date('Y-m-d H:i:s', strtotime($v->created_at)), 'id' => $v->id, 'num' => $v->num, 'money' => $v->money, 'status' => $v->status, 'name' => $v->name, 'mobile' => $v->mobile, 'address' => $v->address, 'send_status' => $v->send_status, 'pass' => $v->pass, 'type' => $v->type, ]; } } catch (\Throwable $exception) { return error($exception->getMessage()); } return success($arr, '成功', 200, $data['total']); } // #[Apidoc\Title("发货记录列表")] // #[Apidoc\Url("api/user/deliverygoods.html")] // #[Apidoc\Method("POST")] // #[Apidoc\Header("token", type: "string", require: true, desc: "身份令牌Token", mock: "@token")] // #[Apidoc\Param("page", type: "int", require: true, desc: "页面", mock: 1)] // #[Apidoc\Param("limit", type: "int", require: true, desc: "输出条数", mock: 10)] // #[Apidoc\Returned(name: "good_name", type: "string", require: true, desc: '商品名称', default: '')] // #[Apidoc\Returned(name: "img", type: "string", require: true, desc: '图片', default: '')] // #[Apidoc\Returned(name: "bonus", type: "string", require: true, desc: '赠送', default: '')] // #[Apidoc\Returned(name: "pay_price", type: "string", require: true, desc: '支付金额', default: '')] // #[Apidoc\Returned(name: "created_at", type: "string", require: true, desc: '购买时间', default: '')] // #[Apidoc\Returned(name: "send_status", type: "string", require: true, desc: '发货状态:1=领取成功,2=发货中,3=已到货', default: '')] // #[Apidoc\Returned(name: "status", type: "string", require: true, desc: '状态 1正常 2失效 3终止', default: '')] // #[Apidoc\Returned(name: "name", type: "string", require: true, desc: '名称', default: '')] // #[Apidoc\Returned(name: "mobile", type: "string", require: true, desc: '手机号', default: '')] // #[Apidoc\Returned(name: "address", type: "string", require: true, desc: '地址', default: '')] // public function deliverygoods(Request $request) // { // $param = $request->param_data; // try { // Validator::input($param, [ // 'page' => Validator::notEmpty()->intType()->setName('页面'), // 'limit' => Validator::notEmpty()->intType()->setName('输出条数'), // ]); // $data = Db::table('wa_my_goods') // ->where('user_id', $request->user_data['id']) // ->where(function ($query) use ($param) { //// if (Arr::get($param, 'type')) { //// $query->where('type', $param['type']); //// } // $query->whereIn('type', [0, 3, 4]); // }) // ->orderByDesc('id') // ->paginate(Arr::get($param, 'limit', 1)) // ->toArray(); // $arr = []; // foreach ($data['data'] as $k => $v) { // $wa_goods = Db::table('wa_goods')->where('id', $v->goods_id)->first(); // $arr[] = [ // 'good_name' => $wa_goods->name, // 'bonus' => $wa_goods->bonus, // 'img' => imageToBase64($wa_goods->img), // 'created_at' => date('Y-m-d H:i:s', strtotime($v->created_at)), // 'id' => $v->id, // 'num' => $v->num, // 'money' => $v->money, // 'status' => $v->status, // 'name' => $v->name, // 'mobile' => $v->mobile, // 'address' => $v->address, // 'type' => $v->type, // 'send_status' => $v->send_status, // ]; // } // } catch (\Throwable $exception) { // return error($exception->getMessage()); // } // return success($arr, '成功', 200, $data['total']); // } }