Merchant.php
2.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<?php
/**
* Created by PhpStorm.
* User: Administrator
* Date: 2019/11/5
* Time: 15:47
*/
namespace app\home\controller;
use app\common\controller\WechatBase;
use EasyWeChat\Foundation\Application;
use think\Db;
class Merchant extends WechatBase
{
protected $user_id;
function _initialize()
{
parent::_initialize();
//判断是否授权
$user_id = get_current_user_id();
if(empty($user_id)){
$this->redirect('user/authorization_view');
}
$this->user_id = $user_id;
}
public function index(){
$data = Db::name('page')->where(['id'=>1])->find();
$this->assign('data',$data);
return $this->fetch();
}
public function enter_view(){
$domain_name = $this->request->domain();//域名
$data = Db::name('merchant_audit')->where(['user_id'=>$this->user_id])->find();
if(!empty($data)){
if($data['status'] == 1){
//审核中
$this->redirect('audit1');
}else if($data['status'] == 2){
//审核通过
$this->redirect('audit2');
}
$business_images = explode(',',$data['business_images']);
foreach($business_images as $key => $b_i){
$business_images[$key] = $domain_name.$b_i;
}
$data['business_images'] = $business_images;
$other_images = explode(',',$data['other_images']);
foreach($other_images as $key => $o_i){
$other_images[$key] = $domain_name.$o_i;
}
$data['other_images'] = $other_images;
}
$this->assign('user_id',$this->user_id);
$this->assign('data',$data);
$this->assign('title','商家入驻');
$options = [
'app_id' => config('wechat.app_id'),
'secret' => config('wechat.secret'),
];
$app = new Application($options);
$js = $app->js;
$jssdk = $js->config(['chooseImage', 'uploadImage', 'previewImage'], $debug = false, $beta = false, $json = true);
$this->assign('jssdk',$jssdk);
return $this->fetch();
}
}