12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- <?php
- namespace app\mobile\controller;
- use app\mobile\logic\CommonLogic;
- use app\admin\logic\CommonLogic as AdminCommonLogic;
- use app\BaseController;
- use app\mobile\logic\AccountLogic;
- use app\model\CommonModel;
- use think\exception\ValidateException;
- use think\facade\Config;
- use think\facade\Validate;
- //公共
- class Common extends BaseController
- {
- //省市区编码
- public function area()
- {
- $parent_code = $this->request->post('parent_code', '');
- return AdminCommonLogic::getAddr($parent_code);
- }
- //视频列表
- public function getVideoList()
- {
- $param = $this->request->only(['page' => 1, 'size' => 10], 'post');
- return CommonLogic::getVideoList($param);
- }
- //手机主题
- public function theme()
- {
- return CommonLogic::theme();
- }
- //微信支付预下单
- public function getPrepayId(){
- $param = $this->request->only(['type','list'],'post');
- $val = Validate::rule([
- 'type|购买类型'=>'require|number|in:'.CommonModel::$pay_type_service.','.CommonModel::$pay_type_shopping_good,
- 'list|购买列表'=>'require|array|max:100',
- ]);
- if (!$val->check($param)) throw new ValidateException($val->getError());
- $val2 = Validate::rule([
- 'id'=>'require|number|gt:0',
- 'num|购买数量'=>'require|number|max:99999999',
- ]);
- foreach ($param['list'] as $list){
- if(!$val2->check($list)) throw new ValidateException($val2->getError());
- }
- return CommonLogic::getPrepayId($param);
- }
- }
|