|
@@ -2,18 +2,16 @@
|
|
|
namespace app\admin\controller\auction;
|
|
|
|
|
|
use app\admin\controller\AuthController;
|
|
|
-use app\admin\controller\Union;
|
|
|
-use app\admin\model\auction\AuctionGu;
|
|
|
use app\admin\model\User;
|
|
|
use crmeb\services\{ExpressService,
|
|
|
JsonService,
|
|
|
+ JsonService as Json,
|
|
|
MiniProgramService,
|
|
|
upload\Upload,
|
|
|
WechatService,
|
|
|
FormBuilder as Form,
|
|
|
CacheService,
|
|
|
- UtilService as Util,
|
|
|
- JsonService as Json};
|
|
|
+ UtilService as Util};
|
|
|
use app\admin\model\system\{
|
|
|
SystemAttachment as SystemAttachmentModel, SystemAttachmentCategory as Category
|
|
|
};
|
|
@@ -56,13 +54,46 @@ class Auction extends AuthController
|
|
|
* @return \think\Response
|
|
|
*/
|
|
|
public function create($id = 0)
|
|
|
+ {
|
|
|
+ $f = [];
|
|
|
+ $f[] = Form::input('name', '场次名称')->col(12);
|
|
|
+ $f[] = Form::input('advert', '预约广告值')->col(12);
|
|
|
+ $f[] = Form::input('lowest', '额度门槛');
|
|
|
+ $f[] = Form::input('minimum', '广告值门槛');
|
|
|
+ $f[] = Form::input('dispatch', '派单百分比%', 100)->col(12);
|
|
|
+ $f[] = Form::frameImageOne('image', '场次主图片(305*305px)', Url::buildUrl('admin/widget.images/index', array('fodder' => 'image')))->icon('image')->width('100%')->height('500px');
|
|
|
+ $f[] = Form::radio('status', '状态', 1)->options([['label' => '开启', 'value' => 1], ['label' => '关闭', 'value' => 0]]);
|
|
|
+
|
|
|
+ $f[] = Form::dateTimes('radd_time', '入场时间');
|
|
|
+ $f[] = Form::dateTimes('rend_time', '结束时间');
|
|
|
+ $f[] = Form::input('sort', '排序',0);
|
|
|
+ $f[] = Form::textarea('info', '介绍');
|
|
|
+
|
|
|
+ $form = Form::make_post_form('添加', $f, Url::buildUrl('save'));
|
|
|
+ $this->assign(compact('form'));
|
|
|
+ return $this->fetch('public/form-builder');
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 修改页面
|
|
|
+ * @param $id
|
|
|
+ * @return string
|
|
|
+ * @throws \FormBuilder\exception\FormBuilderException
|
|
|
+ * @throws \think\db\exception\DataNotFoundException
|
|
|
+ * @throws \think\db\exception\DbException
|
|
|
+ * @throws \think\db\exception\ModelNotFoundException
|
|
|
+ */
|
|
|
+ public function edit($id)
|
|
|
{
|
|
|
$data = \app\admin\model\auction\Auction::find($id);
|
|
|
$f = [];
|
|
|
$f[] = Form::input('name', '场次名称', $data->getData('name'))->col(12);
|
|
|
$f[] = Form::input('advert', '预约广告值', $data->getData('advert'))->col(12);
|
|
|
- $f[] = Form::input('lowest', '最低消费额度', $data->getData('lowest'));
|
|
|
- $f[] = Form::input('minimum', '最低广告值', $data->getData('minimum'));
|
|
|
+ $f[] = Form::input('lowest', '额度门槛', $data->getData('lowest'));
|
|
|
+ $f[] = Form::input('minimum', '广告值门槛', $data->getData('minimum'));
|
|
|
+ $f[] = Form::input('dispatch', '派单百分比%', $data->getData('dispatch'));
|
|
|
$f[] = Form::frameImageOne('image', '场次主图片(305*305px)', Url::buildUrl('admin/widget.images/index', array('fodder' => 'image')), $data->getData('image'))->icon('image')->width('100%')->height('500px');
|
|
|
$f[] = Form::radio('status', '状态', $data->getData('status'))->options([['label' => '开启', 'value' => 1], ['label' => '关闭', 'value' => 0]]);
|
|
|
|
|
@@ -70,12 +101,11 @@ class Auction extends AuthController
|
|
|
$f[] = Form::dateTimes('rend_time', '结束时间', $data->getData('rend_time'));
|
|
|
$f[] = Form::input('sort', '排序', $data->getData('sort'));
|
|
|
$f[] = Form::textarea('info', '介绍', $data->getData('info'));
|
|
|
+ $f[] = Form::hidden('id', $id);
|
|
|
|
|
|
- $form = Form::make_post_form('添加', $f, Url::buildUrl('save'));
|
|
|
+ $form = Form::make_post_form('修改', $f, Url::buildUrl('save'));
|
|
|
$this->assign(compact('form'));
|
|
|
return $this->fetch('public/form-builder');
|
|
|
-
|
|
|
-
|
|
|
}
|
|
|
|
|
|
|
|
@@ -93,10 +123,10 @@ class Auction extends AuthController
|
|
|
'info',
|
|
|
'advert',
|
|
|
'lowest',
|
|
|
- 'minimum'
|
|
|
+ 'minimum',
|
|
|
+ 'dispatch'
|
|
|
]);
|
|
|
- $validate = Validate::rule('nickname', 'require')->rule([
|
|
|
- 'name' => 'require',
|
|
|
+ $validate = Validate::rule('name', 'require')->rule([
|
|
|
'image' => 'require',
|
|
|
'status' => 'require',
|
|
|
'advert' => 'require',
|
|
@@ -104,6 +134,7 @@ class Auction extends AuthController
|
|
|
'rend_time' => 'require',
|
|
|
'lowest' => 'require',
|
|
|
'minimum' => 'require',
|
|
|
+ 'dispatch' => 'require',
|
|
|
]);
|
|
|
$validate->message([
|
|
|
'name.require' => '名称不能为空',
|
|
@@ -114,15 +145,22 @@ class Auction extends AuthController
|
|
|
'rend_time.require' => '请选择结束时间',
|
|
|
'lowest.require' => '请填写额度门槛',
|
|
|
'minimum.require' => '请选择广告值门槛',
|
|
|
+ 'dispatch.require' => '请填写派单量',
|
|
|
]);
|
|
|
if (!$validate->check($data)) {
|
|
|
return Json::fail($validate->getError());
|
|
|
}
|
|
|
- $res = $mode->save($data);
|
|
|
+ if ($data['id']){
|
|
|
+ $details = $mode->find($data['id']);
|
|
|
+ unset($data['id']);
|
|
|
+ $res = $details->save($data);
|
|
|
+ }else{
|
|
|
+ $res = $mode->save($data);
|
|
|
+ }
|
|
|
if ($res){
|
|
|
- return Json::success('添加成功!');
|
|
|
+ return Json::success('成功!');
|
|
|
}else{
|
|
|
- return Json::fail('添加失败');
|
|
|
+ return Json::fail('失败');
|
|
|
}
|
|
|
|
|
|
}
|
|
@@ -160,46 +198,4 @@ class Auction extends AuthController
|
|
|
return Json::fail(\app\admin\model\auction\Auction::getErrorInfo());
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- public function edit($id)
|
|
|
- {
|
|
|
- if (!$id) Json::fail('数据不存在');
|
|
|
- $data = \app\admin\model\auction\Auction::find($id);
|
|
|
- $f = [];
|
|
|
- $f[] = Form::input('nickname', '场次名称', $data->getData('nickname'))->col(12);
|
|
|
- $f[] = Form::input('anticipate', '预约价格', $data->getData('anticipate'))->col(12);
|
|
|
- $f[] = Form::frameImageOne('image', '场次主图片(305*305px)',Url::buildUrl('admin/widget.images/index', array('fodder' => 'image')), $data->getData('image'))->icon('image')->width('100%')->height('500px');
|
|
|
- $f[] = Form::radio('status', '状态', $data->getData('status'))->options([['label' => '开启', 'value' => 1], ['label' => '关闭', 'value' => 0]])->col(12);
|
|
|
- $f[] = Form::select('auction_gu_id', '绑定场馆', (string)$data->getData('auction_gu_id'))->setOptions(function () {
|
|
|
- $model = new AuctionGu();
|
|
|
- $list = $model->select();
|
|
|
- $menus = [];
|
|
|
- foreach ($list as $menu) {
|
|
|
- $menus[] = ['value' => $menu['id'], 'label' => $menu['name']];
|
|
|
- }
|
|
|
- return $menus;
|
|
|
- })->filterable(1)->col(12);
|
|
|
- $f[] = Form::dateTimes('add_time', '预约开始时间', $data->getData('add_time'));
|
|
|
- $f[] = Form::dateTimes('end_time', '预约结束时间', $data->getData('end_time'));
|
|
|
- $f[] = Form::dateTimes('radd_time', '入场时间', $data->getData('radd_time'));
|
|
|
- $f[] = Form::dateTimes('rend_time', '结束时间', $data->getData('rend_time'));
|
|
|
- $f[] = Form::input('sort', '排序', '0', $data->getData('sort'));
|
|
|
- $f[] = Form::textarea('info', '介绍', $data->getData('info'))->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 get_auction($id)
|
|
|
- {
|
|
|
- if (!$id) Json::fail('数据不存在');
|
|
|
- $model = new \app\admin\model\auction\Auction();
|
|
|
- $info = $model->find($id);
|
|
|
-
|
|
|
- $data['productInfo'] = $info;
|
|
|
- return JsonService::successful($data);
|
|
|
- }
|
|
|
-
|
|
|
}
|