fetch(); } /** * 获取列表 * @return void */ public function list() { $where = Util::getMore([ ['page', 1], ['limit', 20], ['name', ''], ['product', ''], ['status', ''] ]); $data = model::list($where); return Json::successlayui($data); } public function edit($id) { if (!$id) Json::fail('数据不存在'); $data = \app\admin\model\auction\AuctionDeliver::find($id); $f = []; $f[] = Form::input('real_name', '用户姓名', $data->getData('real_name'))->col(12); $f[] = Form::input('user_phone', '用户手机号', $data->getData('user_phone'))->col(12); $f[] = Form::input('user_address', '用户收货地址', $data->getData('user_address'))->col(12); $form = Form::make_post_form('修改', $f, Url::buildUrl('update', compact('id'))); $this->assign(compact('form')); return $this->fetch('public/form-builder'); } public function update() { $data = Util::postMore([ 'id', 'real_name', 'user_phone', 'user_address', ]); $validate = Validate::rule([ 'real_name' => 'require', 'user_phone' => 'require', 'user_address' => 'require' ]); $validate->message([ 'real_name.require' => '收货人姓名不能为空', 'user_phone.require' => '收货人手机号不能为空', 'user_address.require' => '收货地址不能为空', ]); if (!$validate->check($data)) { return Json::fail($validate->getError()); } $res = \app\admin\model\auction\AuctionDeliver::update($data); if ($res){ return Json::success('修改成功!'); }else{ return Json::fail(\app\admin\model\auction\Auction::getErrorInfo()); } } /* * 发送货 * @param int $id * @return html * */ public function order_goods($id = 0) { $list = Express::where('is_show', 1)->order('sort desc')->column('name', 'id'); $this->assign([ 'list' => $list, 'id' => $id ]); return $this->fetch(); } /** * TODO 送货信息提交 * @param Request $request * @param $id */ public function update_delivery($id = 0) { $data = Util::postMore([ ['delivery_name', ''], ['delivery_id', ''], ], $this->request); $deliver = \app\admin\model\auction\AuctionDeliver::where('id', $id)->find(); if ($deliver['status'] == 2) return Json::fail('已收货无法修改'); $deliver['delivery_name'] = $data['delivery_name']; $deliver['delivery_id'] = $data['delivery_id']; $deliver['status'] = 1; $deliver['goods_time'] = time(); $deliver->save(); //短信发送 event('ShortMssageSend', [\app\admin\model\auction\AuctionDeliver::where('id', $id)->value('name'), 'Deliver']); return Json::successful('成功!'); } }