123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- <?php
- namespace app\api\controller\user;
- use app\models\user\UserEnter;
- use app\Request;
- use crmeb\services\GroupDataService;
- use crmeb\services\QrcodeService;
- use crmeb\services\SystemConfigService;
- use crmeb\services\UtilService;
- use crmeb\services\upload\Upload;
- use think\facade\Db;
- use think\facade\Validate;
- /**
- * 商户表
- * Class UserBillController
- * @package app\api\controller\user
- */
- class UserEnterController
- {
- /**
- * 申请商户记录
- * @param Request $request
- * @return mixed
- */
- public function list(Request $request)
- {
- $where = UtilService::getMore([
- ['page', 1],
- ['limit', 10],
- ]);
- $where['uid'] = $request->uid();
- $list = UserEnter::list($where);
- return app('json')->success($list);
- }
- public function apply(Request $request)
- {
- if ($request->user()['is_merchant'] == 1) return app('json')->fail('已是商户');
- $data = UtilService::postMore([
- ['province', ''],
- ['city', ''],
- ['district', ''],
- ['address', ''],
- ['merchant_name', ''],
- ['link_user', ''],
- ['link_tel', ''],
- ['charter', ''],
- ]);
- $validate = Validate::rule(['province' => 'require', 'city' => 'require', 'district' => 'require', 'address' => 'require', 'merchant_name' => 'require', 'link_user' => 'require', 'link_tel' => 'require', 'charter' => 'require',]);
- $validate->message([
- 'province.require' => '请填写所在省',
- 'city.require' => '请填写所在市',
- 'district.require' => '请填写所在区',
- 'address.require' => '请填写详细地址',
- 'merchant_name.require' => '请填写商户名称',
- 'link_user.require' => '请填写商户姓名',
- 'link_tel.require' => '请填写商户电话',
- 'charter.require' => '请填写商户证书',
- ]);
- $data['uid'] = $request->uid();
- if (!$validate->check($data)) return app('json')->fail($validate->getError());
- $res = UserEnter::create($data);
- if ($res) return app('json')->success('提交成功');
- return app('json')->fail('提交失败');
- }
- }
|