123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137 |
- <?php
- namespace app\admin\controller\auction;
- use app\admin\controller\AuthController;
- use app\admin\controller\Union;
- use app\admin\model\user\User;
- use app\admin\model\user\UserBill;
- use crmeb\services\{ExpressService,
- JsonService,
- MiniProgramService,
- upload\Upload,
- WechatService,
- FormBuilder as Form,
- CacheService,
- UtilService as Util,
- JsonService as Json};
- use app\admin\model\system\{Express, SystemAttachment as SystemAttachmentModel, SystemAttachmentCategory as Category};
- use app\admin\model\auction\AuctionDeliver as model;
- use think\facade\Route as Url;
- use think\facade\Validate;
- /**
- * 竞拍管理
- * Class StoreOrder
- * @package app\admin\controller\store
- */
- class AuctionDeliver extends AuthController
- {
- public function index()
- {
- return $this->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('成功!');
- }
- }
|