1557492053 hai 1 ano
pai
achega
f19800961b

+ 11 - 12
application/api/controller/Index.php

@@ -22,9 +22,7 @@ class Index extends Api
 
     /**
      * 获取banner
-     * @throws \think\db\exception\DataNotFoundException
-     * @throws \think\db\exception\ModelNotFoundException
-     * @throws \think\exception\DbException
+     * @return void
      */
     public function fetchBanner()
     {
@@ -44,24 +42,25 @@ class Index extends Api
         $timestamp = $this->request->param('timestamp', "");
         $nonce = $this->request->param('nonce', "");
         $echostr = $this->request->param('echostr', "");
-        if($this->checkSignature($signature,$timestamp,$nonce)){
+        if ($this->checkSignature($signature, $timestamp, $nonce)) {
             ob_clean();
-            echo $echostr;die;//这里特别注意,如果不用die结束程序会token验证失败
-        }else{
+            echo $echostr;
+            die;//这里特别注意,如果不用die结束程序会token验证失败
+        } else {
             echo false;
         }
     }
 
-    private function checkSignature($signature,$timestamp,$nonce)
+    private function checkSignature($signature, $timestamp, $nonce)
     {
         $token = "M1xMa324s5sa6geYsdhU342";//这里写你在微信公众平台里面填写的token
-        $tmpArr = array($token,$timestamp, $nonce);
+        $tmpArr = array($token, $timestamp, $nonce);
         sort($tmpArr, SORT_STRING);
-        $tmpStr = implode( $tmpArr );
-        $tmpStr = sha1( $tmpStr );
-        if($tmpStr == $signature){
+        $tmpStr = implode($tmpArr);
+        $tmpStr = sha1($tmpStr);
+        if ($tmpStr == $signature) {
             return true;
-        }else{
+        } else {
             return false;
         }
     }

+ 2 - 2
application/api/controller/Login.php

@@ -144,13 +144,13 @@ class Login extends Api
         if (!isset($userinfo["unionid"]) || !isset($userinfo["openid"]))
             $this->error("微信登录错误! unionid|openid 不能为空!");
         $userModel = new \app\api\model\User();
-        $parent_id = isset($params["parent_id"]) ? $params["parent_id"] : null;
+        $parent_id = $params["parent_id"] ?? null;
         if ($parent_id > 0) {
             $parent = $userModel->get($parent_id);
             if (is_null($parent))
                 $this->error("推荐人不存在!");
         }
-        $invite_store_id = isset($params["invite_store_id"]) ? $params["invite_store_id"] : null;
+        $invite_store_id = $params["invite_store_id"] ?? null;
         $existUser = $userModel->findByUnionId($userinfo["unionid"]);
         if (!$existUser) {
             $username = "U" . time();

+ 6 - 1
application/api/controller/Test.php

@@ -21,7 +21,12 @@ class Test extends Api
 
     function test1()
     {
-        self::certificates();
+        $result = getenv(ENV_PREFIX . strtoupper(str_replace('.', '_', "wxpay.wx_applet_secret")));
+        var_dump($result);
+    }
+
+    public function test2()
+    {
     }
 
     /**

+ 2 - 2
application/api/service/MassagerService.php

@@ -281,10 +281,10 @@ class MassagerService extends BaseService
         foreach ($items as &$item) {
             $item["membership_discount_price"] = fixed2Float($item["real_price"] * $membership_discount_rate);
             if ($item["id"] != 276) {
-                array_push($available_services, $item);
+                $available_services[] = $item;
             } else {
                 if ($massager["store_id"] == $exist && $exist > 0) {
-                    array_push($available_services, $item);
+                    $available_services[] = $item;
                 }
             }
         }

+ 4 - 4
application/api/service/OrderService.php

@@ -209,7 +209,7 @@ class OrderService extends BaseService
             $db_service = [];
             foreach ($services as $service) {
                 $quantity = $option_services[$service['id']]['quantity'];
-                array_push($db_service, [
+                $db_service[] = [
                     "order_id" => $order->id,
                     "store_id" => $store_id,
                     "service_id" => $service['id'],
@@ -221,7 +221,7 @@ class OrderService extends BaseService
                     "status" => \E_BASE_STATUS::Normal,
                     "createtime" => time(),
                     "updatetime" => time(),
-                ]);
+                ];
             }
             $total_service_amount = array_reduce($db_service, function ($p, $cur) {
                 $p += ($cur["amount"] * $cur["quantity"]);
@@ -278,7 +278,7 @@ class OrderService extends BaseService
             $db_service = [];
             foreach ($old_order["services"] as $item) {
                 $service = $this->serviceModel->get($item['service_id']);
-                array_push($db_service, [
+                $db_service[] = [
                     "order_id" => $new_order["id"],
                     "store_id" => $service['store_id'],
                     "service_id" => $service['id'],
@@ -290,7 +290,7 @@ class OrderService extends BaseService
                     "status" => \E_BASE_STATUS::Normal,
                     "createtime" => time(),
                     "updatetime" => time()
-                ]);
+                ];
             }
             $total_service_amount = array_reduce($db_service, function ($p, $cur) {
                 $p += ($cur["amount"] * $cur["quantity"]);

+ 2 - 2
application/api/service/WalletService.php

@@ -234,7 +234,7 @@ class WalletService extends BaseService
             }
 
             foreach ($types as $key => $value) {
-                array_push($progress, [
+                $progress[] = [
                     "order_id" => $order->id,
                     "order_no" => $order->no,
                     "type" => $value,
@@ -246,7 +246,7 @@ class WalletService extends BaseService
                     "card_image" => null,
                     "createtime" => time(),
                     "updatetime" => time()
-                ]);
+                ];
             }
             (new Progress())->insertAll($progress);
             if ($order["massager_id"] > 0 && $massager["mobile"]) {

+ 4 - 4
application/command/Profit.php

@@ -78,15 +78,15 @@ class Profit extends Command
                     \db("order")->where("id", $order["id"])->update([
                         "is_use_profit" => 1
                     ]);
-                    array_push($logs, [
+                    $logs[] = [
                         "order_id" => $order["id"],
                         "s_res" => $res->code()
-                    ]);
+                    ];
                 } else {
-                    array_push($logs, ["order_id" => $order["id"], "s_res" => $res->msg()]);
+                    $logs[] = ["order_id" => $order["id"], "s_res" => $res->msg()];
                 }
             } catch (Exception $e) {
-                array_push($logs, ["order_id" => $order["id"], "s_res" => $e->getMessage()]);
+                $logs[] = ["order_id" => $order["id"], "s_res" => $e->getMessage()];
             } finally {
                 $orderLock->unlock($oLock);
             }

+ 1 - 2
application/common/library/Sms.php

@@ -129,8 +129,7 @@ class Sms
      */
     public static function flush($mobile, $event = 'default')
     {
-        \app\common\model\Sms::
-        where(['mobile' => $mobile, 'event' => $event])
+        \app\common\model\Sms::where(['mobile' => $mobile, 'event' => $event])
             ->delete();
         Hook::listen('sms_flush');
         return true;

+ 1 - 1
application/index/controller/Index.php

@@ -14,7 +14,7 @@ class Index extends Frontend
 
     public function index()
     {
-        echo "index";
+        echo phpinfo();
 //        return $this->view->fetch();
     }