代码提交优化
This commit is contained in:
@@ -12,17 +12,28 @@ use think\Db;
|
||||
|
||||
class PosterWeChatMiniProgram extends Controller
|
||||
{
|
||||
|
||||
protected $config;
|
||||
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
// 从环境变量获取配置
|
||||
$this->config = [
|
||||
'app_id' => Env::get('weChat.appidMiniApp','wx789850448e26c91d'),
|
||||
'secret' => Env::get('weChat.secretMiniApp','d18f75b3a3623cb40da05648b08365a1'),
|
||||
'response_type' => 'array'
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
public function index()
|
||||
{
|
||||
return 'Hello, World!';
|
||||
}
|
||||
|
||||
const MINI_PROGRAM_CONFIG = [
|
||||
'app_id' => 'wx789850448e26c91d',
|
||||
'secret' => 'd18f75b3a3623cb40da05648b08365a1',
|
||||
'response_type' => 'array'
|
||||
];
|
||||
|
||||
|
||||
// 生成小程序码,存客宝-操盘手调用
|
||||
public function generateMiniProgramCodeWithScene($taskId = '')
|
||||
@@ -34,7 +45,7 @@ class PosterWeChatMiniProgram extends Controller
|
||||
|
||||
|
||||
try {
|
||||
$app = Factory::miniProgram(self::MINI_PROGRAM_CONFIG);
|
||||
$app = Factory::miniProgram($this->config);
|
||||
// scene参数长度限制为32位
|
||||
//$scene = 'taskId=' . $taskId;
|
||||
$scene = sprintf("%s", $taskId);
|
||||
@@ -83,7 +94,7 @@ class PosterWeChatMiniProgram extends Controller
|
||||
]);
|
||||
}
|
||||
|
||||
$app = Factory::miniProgram(self::MINI_PROGRAM_CONFIG);
|
||||
$app = Factory::miniProgram($this->config);
|
||||
|
||||
$result = $app->phone_number->getUserPhoneNumber($code);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user