|
@@ -24,18 +24,30 @@ class Applet extends Base
|
|
|
{
|
|
|
$token = Dever::project('token');
|
|
|
$applet = array();
|
|
|
+
|
|
|
+ $system = Dever::input('system', 1);
|
|
|
+
|
|
|
+ $config = Dever::config('base', 'project')->applet;
|
|
|
+
|
|
|
if ($token) {
|
|
|
- $applet = Dever::db('token/project')->one(Dever::input('appid', 1));
|
|
|
+ $applet = Dever::db('token/project')->one($system);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!$applet) {
|
|
|
+ if (isset($config['project']) && $config['project']) {
|
|
|
+ $applet = Dever::db($config['project'])->one($system);
|
|
|
+ } else {
|
|
|
+ $applet = $config;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
if (!$applet) {
|
|
|
- $applet = Dever::config('base', 'project')->applet;
|
|
|
+ Dever::alert('错误的appid');
|
|
|
}
|
|
|
-
|
|
|
|
|
|
$appid = $applet['appid'];
|
|
|
$secret = $applet['secret'];
|
|
|
- $url = $applet['url'];
|
|
|
+ $url = $config['url'];
|
|
|
$code = Dever::input('code');
|
|
|
|
|
|
$url .= '?appid=' . $appid;
|