1234567891011121314151617181920212223242526272829303132333435 |
- <?php
- /**
- * Created by PhpStorm.
- * User: Bear
- * Date: 2019/4/9
- * Time: 下午7:40
- */
- namespace app\clientwebapi\controller;
- use app\common\controller\ClientWebApi;
- use app\main\service\AdminService;
- use app\main\service\WebUserService;
- use app\main\service\WxH5PayService;
- class Wxpay extends ClientWebApi
- {
- public function pay()
- {
- if (!WebUserService::instance()->getUserInfo()->id) {
- $this->error("请登录后重试");
- }
- $goods_id = $this->request->request('id');
- $category = $this->request->request('category');
- if(!$goods_id || !$category){
- $this->error("参数错误");
- }
- $channel_id = WebUserService::instance()->getUserInfo()->channel_id;
- $adminInfo = AdminService::instance()->getAdminConfigModel()->getAdminInfo($channel_id);
- $wxpayid = $adminInfo['wxpay_id'];
- $platformid = $adminInfo['platform_id'];
- $result = WxH5PayService::instance()->getPayUrl($goods_id, $category, $platformid, $wxpayid);
- return redirect($result->data);
- }
- }
|