hrjy 2 years ago
parent
commit
c0f858cdc6

+ 3 - 0
app/admin/model/order/StoreOrder.php

@@ -130,6 +130,9 @@ class StoreOrder extends BaseModel
                     case 'yue':
                         $item['pay_type_name'] = '余额支付';
                         break;
+                    case 'alipay_wap':
+                        $item['pay_type_name'] = '支付宝支付';
+                        break;
                     case 'offline':
                         $item['pay_type_name'] = '线下支付';
                         break;

+ 56 - 11
app/api/controller/AdaPayController.php

@@ -7,27 +7,24 @@ use app\models\article\ArticleContent;
 use app\models\store\StoreOrder;
 use app\Request;
 use crmeb\services\UtilService;
-
+include_once  dirname(__FILE__). "/AdapayCore/utils/AdaTools.php";
 /**
- * 抖音小程序
+ *
  * Class DouYiCantroller
  * @package app\api\controller
  */
 class AdaPayController
 {
+    public $rsaPublicKeyFilePath = "";
+    public $rsaPublicKey = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCwN6xgd6Ad8v2hIIsQVnbt8a3JituR8o4Tc3B5WlcFR55bz4OMqrG/356Ur3cPbc2Fe8ArNd/0gZbC9q56Eb16JTkVNA/fye4SXznWxdyBPR7+guuJZHc/VW2fKH2lfZ2P3Tt0QkKZZoawYOGSMdIvO+WqK44updyax0ikK6JlNQIDAQAB";
 
     public function notify(Request $request)
     {
-        $post = UtilService::postMore(
-            ['data', ''],
-            ['sing', '']
-        );
-        $ada = new AdaTools();
-        ArticleContent::create(['content' => $post['data']]);
-        ArticleContent::create(['content' => $post['sing']]);
-        $res = $ada->verifySign($post['sing'], $post['data']);
+        $post = $request->post();
+        $data = json_decode($post['data']);
+        $sing = $post['sign'];
+        $res = $this->verifySign($sing, $post['data']);
         if($res){
-            $data = json_decode($post['data']);
             $order = strstr($data->order_no, '-', -1);
             $res = StoreOrder::paySuccess($order, $data->pay_channel);
             if ($res){
@@ -35,9 +32,57 @@ class AdaPayController
                 exit();
             }
         }else {
+            ArticleContent::create(['content' => 'error']);
             echo 'error';
             exit();
         }
     }
 
+    public function cz_notify(Request $request)
+    {
+        $post = $request->post();
+        $data = json_decode($post['data']);
+        $sing = $post['sign'];
+        $res = $this->verifySign($sing, $post['data']);
+        if($res){
+            $order = strstr($data->order_no, '-', -1);
+            $res = StoreOrder::rechargeSuccess($order);
+            if ($res){
+                echo '200';
+                exit();
+            }
+        }else {
+            ArticleContent::create(['content' => 'error']);
+            echo 'error';
+            exit();
+        }
+    }
+
+
+    public function checkEmpty($value) {
+        if (!isset($value))
+            return true;
+        if ($value === null)
+            return true;
+        if (trim($value) === "")
+            return true;
+        return false;
+    }
+
+
+    public function verifySign($signature, $data){
+        if($this->checkEmpty($this->rsaPublicKeyFilePath)){
+            $pubKey=$this->rsaPublicKey;
+            $key = "-----BEGIN PUBLIC KEY-----\n".wordwrap($pubKey, 64, "\n", true)."\n-----END PUBLIC KEY-----";
+        }else {
+            $pubKey = file_get_contents($this->rsaPublicKeyFilePath);
+            $key = openssl_get_publickey($pubKey);
+        }
+        if (openssl_verify($data, base64_decode($signature), $key)){
+            return true;
+        }else{
+            return false;
+        }
+    }
+
 }

+ 1 - 1
app/api/controller/AdapayCore/utils/AdaTools.php

@@ -6,7 +6,7 @@ class AdaTools
     public $rsaPrivateKeyFilePath = "";
     public $rsaPublicKeyFilePath = "";
     public $rsaPrivateKey = "";
-    public $rsaPublicKey = "";
+    public $rsaPublicKey = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCwN6xgd6Ad8v2hIIsQVnbt8a3JituR8o4Tc3B5WlcFR55bz4OMqrG/356Ur3cPbc2Fe8ArNd/0gZbC9q56Eb16JTkVNA/fye4SXznWxdyBPR7+guuJZHc/VW2fKH2lfZ2P3Tt0QkKZZoawYOGSMdIvO+WqK44updyax0ikK6JlNQIDAQAB";
 
     public function generateSignature($url, $params){
         if (is_array($params)){

+ 66 - 21
app/api/controller/AuthController.php

@@ -129,19 +129,37 @@ class AuthController
     {
         list($phone, $type, $key, $code) = UtilService::postMore([['phone', 0], ['type', ''], ['key', ''], ['code', '']], $request, true);
 
-        $keyName = 'sms.key.' . $key;
-        $nowKey = 'sms.' . date('YmdHi');
-
-        if (!Cache::has($keyName))
-            return app('json')->make(401, '发送验证码失败');
+        $temp = function ($item) {
+            switch ($item) {
+                case "register":
+                    return 'REGISTER';
+                case "login":
+                    return 'LOGIN';
+                case "reset":
+                    return 'RESET';
+                case "reset_2":
+                    return 'RESET_2';
+                case "trade":
+                    return 'TRADE';
+                default:
+                    return 'DEFAULT';
+            }
+        };
 
-        if (($num = Cache::get($keyName)) > 2) {
-            if (!$code)
-                return app('json')->make(402, '请输入验证码');
 
-            if (!$this->checkCaptcha($key, $code))
-                return app('json')->fail('验证码输入有误');
-        }
+//        $keyName = 'sms.key.' . $key;
+        $nowKey = 'sms.' . date('YmdHi');
+//
+//        if (!Cache::has($keyName))
+//            return app('json')->make(401, '发送验证码失败');
+//
+//        if (($num = Cache::get($keyName)) > 2) {
+//            if (!$code)
+//                return app('json')->make(402, '请输入验证码');
+//
+//            if (!$this->checkCaptcha($key, $code))
+//                return app('json')->fail('验证码输入有误');
+//        }
 
         $total = 1;
         if ($has = Cache::has($nowKey)) {
@@ -149,7 +167,6 @@ class AuthController
             if ($total > Config::get('sms.maxMinuteCount', 20))
                 return app('json')->success('已发送');
         }
-
         try {
             validate(RegisterValidates::class)->scene('code')->check(['phone' => $phone]);
         } catch (ValidateException $e) {
@@ -162,27 +179,55 @@ class AuthController
         $defaultMaxIpCount = Config::get('sms.maxIpCount', 50);
         $maxPhoneCount = Config::get('sms.stores.' . $default . '.maxPhoneCount', $defaultMaxPhoneCount);
         $maxIpCount = Config::get('sms.stores.' . $default . '.maxIpCount', $defaultMaxIpCount);
-        if (SmsRecord::where('phone', $phone)->where('add_ip', $request->ip())->whereDay('add_time')->count() >= $maxPhoneCount) {
-            return app('json')->fail('您今日发送得短信次数已经达到上限');
-        }
+//        if (SmsRecord::where('phone', $phone)->where('add_ip', $request->ip())->whereDay('add_time')->count() >= $maxPhoneCount) {
+//            return app('json')->fail('您今日发送得短信次数已经达到上限');
+//        }
         if (SmsRecord::where('add_ip', $request->ip())->whereDay('add_time')->count() >= $maxIpCount) {
             return app('json')->fail('此IP今日发送次数已经达到上限');
         }
         $time = 60;
-        if (CacheService::get('code_' . $phone))
-            return app('json')->fail($time . '秒内有效');
+//        if (CacheService::get('code_' . $phone))
+//            return app('json')->fail($time . '秒内有效');
         $code = rand(100000, 999999);
         $data['code'] = $code;
-        $res = ShortLetterRepositories::send(true, $phone, $data, 'VERIFICATION_CODE');
+        $res = self::NewSmsSend($phone, $data, $temp($type));
+//        $res = ShortLetterRepositories::send(true, $phone, $data, 'VERIFICATION_CODE');
         if ($res !== true)
             return app('json')->fail('短信平台验证码发送失败' . $res);
         CacheService::set('code_' . $phone, $code, $time);
-        Cache::set($keyName, $num + 1, 300);
-        Cache::set($nowKey, $total, 61);
+//        Cache::set($keyName, $num + 1, 300);
+//        Cache::set($nowKey, $total, 61);
 
-        return app('json')->success('发送成功');
+        return app('json')->success('短信验证发送成功');
     }
 
+
+    /**
+     * 发送短信
+     * @param string $phone 手机号码
+     * @param array $data 模板替换内容
+     * @param string $template 模板编号
+     * @return bool|string
+     * @throws DataNotFoundException
+     * @throws ModelNotFoundException
+     */
+    public static function NewSmsSend(string $phone, array $data, string $template)
+    {
+        try {
+            $res = ZjSMSServerService::send($phone, $data);
+//            var_dump($res);
+//            exit;
+            if ($res['status'] != '200') {
+                return $res['msg'];
+            } else {
+                SmsRecord::sendRecord($phone, $data['code'], $template, '');
+            }
+            return true;
+        } catch (Exception $exception) {
+//            Log::info($exception->getMessage());
+            return $exception->getMessage();
+        }
+    }
     /**
      * H5注册新用户
      * @param Request $request

+ 85 - 0
app/api/controller/ZjSMSServerService.php

@@ -0,0 +1,85 @@
+<?php
+
+namespace app\api\controller;
+
+use crmeb\services\HttpService;
+use think\facade\Db;
+
+/**
+ * 短信服务
+ * Class SMSService
+ * @package crmeb\services
+ */
+class ZjSMSServerService
+{
+    private static $userid = '15889';
+    private static $username = "yflkj";
+    private static $passwd = 'yfl831**';
+    //验证码
+    const VERIFICATION_CODE = 518076;
+    //支付成功
+    const PAY_SUCCESS_CODE = 520268;
+    //发货提醒
+    const DELIVER_GOODS_CODE = 520269;
+    //确认收货提醒
+    const TAKE_DELIVERY_CODE = 520271;
+    //管理员下单提醒
+    const ADMIN_PLACE_ORDER_CODE = 520272;
+    //管理员退货提醒
+    const ADMIN_RETURN_GOODS_CODE = 520274;
+    //管理员支付成功提醒
+    const ADMIN_PAY_SUCCESS_CODE = 520273;
+    //管理员确认收货
+    const ADMIN_TAKE_DELIVERY_CODE = 520422;
+
+    /**
+     * get: 发送短信验证码
+     * path: sendSmsCode
+     * method: sendSmsCode
+     * param: phone - {string} 手机号
+     */
+    public static function send($phone, array $param, $template = "VERIFICATION_CODE")
+    {
+        $code = $param['code'];
+        $target = "http://sms.izjun.cn/v2sms.aspx";
+        $company = sys_config('site_name', '', true);
+//        $company = "星拼乐";
+        switch ($template) {
+            case 'PAY_SUCCESS_CODE':
+                break;
+            case 'DELIVER_GOODS_CODE':
+                break;
+            case  'TAKE_DELIVERY_CODE':
+                break;
+            case 'ADMIN_PLACE_ORDER_CODE':
+                break;
+            case 'ADMIN_RETURN_GOODS_CODE':
+                break;
+            case 'ADMIN_PAY_SUCCESS_CODE':
+                break;
+            case 'ADMIN_TAKE_DELIVERY_CODE':
+                break;
+            default:
+                $content = sprintf('【%s】您的验证码为:%d 。验证码有效期为%d分钟,请尽快填写!', $company, $code, 5);
+        }
+        $time = date("YmdHis", time());
+        $data = [
+            'action' => 'send',
+            'userid' => self::$userid,
+            'timestamp' => $time,
+            'sign' => md5(self::$username . self::$passwd . $time),
+            'mobile' => $phone,
+            'content' => $content,
+            'sendTime' => '',
+            'extno' => '',
+            'rt' => 'json',
+        ];
+        $gets = json_decode(HttpService::postRequest($target, $data), true);
+        if ($gets) {
+            return ['status' => 200, 'msg' => '短信发送成功'];
+
+        } else {
+            return ['status' => 400, 'msg' => '发送失败'];
+        }
+    }
+}

+ 4 - 0
app/api/controller/order/StoreOrderController.php

@@ -264,6 +264,7 @@ class StoreOrderController
                         //成功处理
                         return app('json')->status('alipay', ['jsConfig' => $payment->result, 'orderId' => $order['order_id']]);
                     }
+                    break;
                 case 'weixin_s':
                     $payment = new \AdaPaySdk\Payment();
                     # 支付设置
@@ -291,6 +292,7 @@ class StoreOrderController
                         return app('json')->status('alipay', ['jsConfig' => $payment->result, 'orderId' => $order['order_id']]);
 
                     }
+                    break;
                 case 'offline':
                     return app('json')->status('success', '订单创建成功', $info);
                     break;
@@ -440,6 +442,7 @@ class StoreOrderController
                     return app('json')->status('alipay', ['jsConfig' => $payment->result, 'order_id' => $order['order_id']]);
 
                 }
+                break;
             case 'weixin_s':
                 $payment = new \AdaPaySdk\Payment();
                 # 支付设置
@@ -467,6 +470,7 @@ class StoreOrderController
                     return app('json')->status('alipay', ['jsConfig' => $payment->result, 'orderId' => $order['order_id']]);
 
                 }
+                break;
             case 'offline':
                 StoreOrder::createOrderTemplate($order);
                 if (StoreOrder::setOrderTypePayOffline($order['order_id']))

+ 61 - 35
app/api/controller/user/UserBillController.php

@@ -206,12 +206,12 @@ class UserBillController
                             array(
                                 'url' => $urlCode,     //二维码资源
                                 'stream' => 0,
-                                'left' => 114,
-                                'top' => 790,
+                                'left' => 225,
+                                'top' => 913,
                                 'right' => 0,
                                 'bottom' => 0,
-                                'width' => 120,
-                                'height' => 120,
+                                'width' => 300,
+                                'height' => 300,
                                 'opacity' => 100
                             )
                         ),
@@ -258,24 +258,16 @@ class UserBillController
                     SystemAttachment::where(['name' => $name])->delete();
                 }
                 if (!$imageInfo) {
-                    try {
-                        $qr_code = QrcodeService::getForeverQrcode('spread', $user['uid']);
-                        if (isset($qr_code['url'])) {
-                            $urlCode = $qr_code['url'];
-                        } else {
-                            $codeUrl = set_http_type($siteUrl . '?spread=' . $user['uid'], 1);//二维码链接
-                            $imageInfo = UtilService::getQRCodePath($codeUrl, $name);
-                            if (is_string($imageInfo)) return app('json')->fail('二维码生成失败', ['error' => $imageInfo]);
-                            SystemAttachment::attachmentAdd($imageInfo['name'], $imageInfo['size'], $imageInfo['type'], $imageInfo['dir'], $imageInfo['thumb_path'], 1, $imageInfo['image_type'], $imageInfo['time'], 2);
-                            $urlCode = $imageInfo['dir'];
-                        }
-                    } catch (\Exception $e) {
-                        $codeUrl = set_http_type($siteUrl . '?spread=' . $user['uid'], 1);//二维码链接
-                        $imageInfo = UtilService::getQRCodePath($codeUrl, $name);
-                        if (is_string($imageInfo)) return app('json')->fail('二维码生成失败', ['error' => $imageInfo]);
-                        SystemAttachment::attachmentAdd($imageInfo['name'], $imageInfo['size'], $imageInfo['type'], $imageInfo['dir'], $imageInfo['thumb_path'], 1, $imageInfo['image_type'], $imageInfo['time'], 2);
-                        $urlCode = $imageInfo['dir'];
-                    }
+//                    $qr_code = QrcodeService::getForeverQrcode('spread', $user['uid']);
+//                    if (isset($qr_code['url'])) {
+//                        $urlCode = $qr_code['url'];
+//                    } else {
+                    $codeUrl = set_http_type($siteUrl . '/register?spread=' . $user['uid'], 1);//二维码链接
+                    $imageInfo = UtilService::getQRCodePath($codeUrl, $name);
+                    if (is_string($imageInfo)) return app('json')->fail('二维码生成失败', ['error' => $imageInfo]);
+                    SystemAttachment::attachmentAdd($imageInfo['name'], $imageInfo['size'], $imageInfo['type'], $imageInfo['dir'], $imageInfo['thumb_path'], 1, $imageInfo['image_type'], $imageInfo['time'], 2);
+                    $urlCode = $imageInfo['dir'];
+//                    }
                 } else $urlCode = $imageInfo['att_dir'];
                 if ($imageInfo['image_type'] == 1) $urlCode = $siteUrl . $urlCode;
                 $siteUrl = set_http_type($siteUrl, 1);
@@ -292,12 +284,12 @@ class UserBillController
                             array(
                                 'url' => $urlCode,     //二维码资源
                                 'stream' => 0,
-                                'left' => 114,
-                                'top' => 790,
+                                'left' => 225,
+                                'top' => 913,
                                 'right' => 0,
                                 'bottom' => 0,
-                                'width' => 120,
-                                'height' => 120,
+                                'width' => 300,
+                                'height' => 300,
                                 'opacity' => 100
                             )
                         ),
@@ -360,53 +352,87 @@ class UserBillController
     }
 
     /**
-     * 动态积分记录
+     * 白积分记录
+     * @param Request $request
+     * @return mixed
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     */
+    public function white_integral(Request $request)
+    {
+        list($page, $limit, $status) = UtilService::getMore([
+            ['page', 0], ['limit', 0], ['pm', 0]
+        ], $request, true);
+        return app('json')->successful(UserBill::userBillList($request->uid(), $page, $limit, 'white_integral', ['pm' => $status]));
+
+    }
+
+    /**
+     * 紫积分记录
+     * @param Request $request
+     * @return mixed
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     */
+    public function purple_integral(Request $request)
+    {
+        list($page, $limit, $status) = UtilService::getMore([
+            ['page', 0], ['limit', 0], ['pm', 0]
+        ], $request, true);
+        return app('json')->successful(UserBill::userBillList($request->uid(), $page, $limit, 'purple_integral', ['pm' => $status]));
+
+    }
+
+    /**
+     * 绿积分记录
      * @param Request $request
      * @return mixed
      * @throws \think\db\exception\DataNotFoundException
      * @throws \think\db\exception\ModelNotFoundException
      * @throws \think\exception\DbException
      */
-    public function dynamic_integral_list(Request $request)
+    public function green_integral(Request $request)
     {
         list($page, $limit, $status) = UtilService::getMore([
             ['page', 0], ['limit', 0], ['pm', 0]
         ], $request, true);
-        return app('json')->successful(UserBill::userBillList($request->uid(), $page, $limit, 'dynamic_integral', ['pm' => $status]));
+        return app('json')->successful(UserBill::userBillList($request->uid(), $page, $limit, 'green_integral', ['pm' => $status]));
 
     }
 
     /**
-     * 消费券记录
+     * 商家积分记录
      * @param Request $request
      * @return mixed
      * @throws \think\db\exception\DataNotFoundException
      * @throws \think\db\exception\ModelNotFoundException
      * @throws \think\exception\DbException
      */
-    public function consumption_list(Request $request)
+    public function business_integral(Request $request)
     {
         list($page, $limit, $status) = UtilService::getMore([
             ['page', 0], ['limit', 0], ['pm', 0]
         ], $request, true);
-        return app('json')->successful(UserBill::userBillList($request->uid(), $page, $limit, 'consumption', ['pm' => $status]));
+        return app('json')->successful(UserBill::userBillList($request->uid(), $page, $limit, 'business_integral', ['pm' => $status]));
 
     }
 
     /**
-     * 贡献值记录
+     * 文票记录
      * @param Request $request
      * @return mixed
      * @throws \think\db\exception\DataNotFoundException
      * @throws \think\db\exception\ModelNotFoundException
      * @throws \think\exception\DbException
      */
-    public function contribution_list(Request $request)
+    public function paper_ticket(Request $request)
     {
         list($page, $limit, $status) = UtilService::getMore([
             ['page', 0], ['limit', 0], ['pm', 0]
         ], $request, true);
-        return app('json')->successful(UserBill::userBillList($request->uid(), $page, $limit, 'contribution', ['pm' => $status]));
+        return app('json')->successful(UserBill::userBillList($request->uid(), $page, $limit, 'paper_ticket', ['pm' => $status]));
 
     }
 }

+ 28 - 0
app/api/controller/user/UserRechargeController.php

@@ -9,6 +9,8 @@ use crmeb\services\GroupDataService;
 use crmeb\services\SystemConfigService;
 use crmeb\services\UtilService;
 
+include_once  dirname(__FILE__). "/../AdapaySdk/init.php";
+include_once  dirname(__FILE__). "/../AdapaySdk/config.php";
 /**
  * 充值类
  * Class UserRechargeController
@@ -102,6 +104,32 @@ class UserRechargeController
                 else
                     return app('json')->fail(UserRecharge::getErrorInfo());
                 break;
+            case 2:
+                $rechargeOrder = UserRecharge::addRecharge($request->uid(), $price, 'alipay');
+                $payment = new \AdaPaySdk\Payment();
+                # 支付设置
+                $payment_params = array(
+                    'app_id'=> 'app_3dc215b5-ade5-47d8-8461-ddb796bd5e06',
+                    'order_no'=> $rechargeOrder['order_id'].'-'.rand(100000, 999999),
+                    'pay_channel'=> 'alipay_wap',
+                    //'time_expire'=> date("YmdHis", time()+86400),
+                    'pay_amt'=> sprintf("%01.2f",$rechargeOrder['price']),
+                    'goods_title'=> '环球优购',
+                    'goods_desc'=> '环球优购',
+                    'description'=> 'alipay',
+                    'device_info'=> ['device_p'=> $_SERVER["REMOTE_ADDR"]],
+                    'callback_url' => 'http://xqyg.frp.liuniu946.com/index',
+                    'notify_url' => 'http://xqyg.frp.liuniu946.com/api/adapay/cz_notify'
+                );
+                $payment->create($payment_params);
+                if ($payment->isError()){
+                    //失败处理
+                    return app('json')->fail('支付失败');
+                } else {
+                    //成功处理
+                    return app('json')->status('alipay', ['jsConfig' => $payment->result, 'orderId' => $rechargeOrder['order_id']]);
+                }
+                break;
             default:
                 return app('json')->fail('缺少参数');
                 break;

+ 25 - 0
app/register/config/route.php

@@ -0,0 +1,25 @@
+<?php
+// +----------------------------------------------------------------------
+// | ThinkPHP [ WE CAN DO IT JUST THINK ]
+// +----------------------------------------------------------------------
+// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
+// +----------------------------------------------------------------------
+// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
+// +----------------------------------------------------------------------
+// | Author: liu21st <liu21st@gmail.com>
+// +----------------------------------------------------------------------
+
+// +----------------------------------------------------------------------
+// | 应用设置
+// +----------------------------------------------------------------------
+
+return [
+    // 是否强制使用路由
+    'url_route_must'        => false,
+    // 合并路由规则
+    'route_rule_merge'      => true,
+    // 路由是否完全匹配
+    'route_complete_match'  => false,
+    // 是否自动转换URL中的控制器和操作名
+    'url_convert'           => true,
+];

+ 20 - 0
app/register/config/view.php

@@ -0,0 +1,20 @@
+<?php
+// +----------------------------------------------------------------------
+// | 模板设置
+// +----------------------------------------------------------------------
+
+return [
+    // 模板后缀
+    'view_suffix'  => 'html',
+    // 模板路径
+    'view_path'    => app_path('view'),
+    // 视图输出字符串内容替换
+    'tpl_replace_string'       => [
+        '{__PUBLIC_PATH}' =>  '/',              //public 目录
+        '{__STATIC_PATH}' =>  '/static/',       //全局静态目录
+        '{__PLUG_PATH}'   =>  '/static/plug/',  //全局静态插件
+        '{__ADMIN_PATH}'  =>  '/system/',        //后台目录
+        '{__FRAME_PATH}'  =>  '/system/frame/',  //后台框架
+        '{__MODULE_PATH}' =>  '/system/module/', //后台模块
+    ]
+];

+ 25 - 0
app/register/controller/Index.php

@@ -0,0 +1,25 @@
+<?php
+
+
+namespace app\register\controller;
+
+
+use app\models\system\Site;
+use crmeb\basic\BaseController;
+
+class Index extends BaseController
+{
+    public function index()
+    {
+        $apk = sys_config('apk', '');
+        $this->assign('apk', $apk);
+        return $this->fetch();
+    }
+
+    public function down()
+    {
+        $apk = sys_config('apk', '');
+        $this->assign('apk', $apk);
+        return $this->fetch();
+    }
+}

+ 3 - 0
app/register/view/index/.vscode/settings.json

@@ -0,0 +1,3 @@
+{
+    "liveServer.settings.port": 5501
+}

+ 99 - 0
app/register/view/index/down.html

@@ -0,0 +1,99 @@
+<!doctype html>
+<html>
+<head>
+    <script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js"></script>
+    <style>
+        .div {
+            width: 100%;
+            height: 100%;
+            position: relative;
+        }
+
+        .button {
+            margin-left: 10%;
+            position: absolute;
+            bottom: 40px;
+            width: 80%;
+            text-align: center;
+            z-index: 999;
+            height: 140px;
+            font-size: 32px;
+            line-height: 140px;
+            letter-spacing: 5px;
+            background-color: #32baff;
+            border-radius: 5px;
+            color: white;
+
+        }
+
+        .img {
+            position: relative;
+            width: 100%;
+        }
+
+        img {
+            max-width: 100%;
+            height: auto;
+        }
+
+        .weixin-tip {
+            display: none;
+            position: fixed;
+            left: 0;
+            top: 0;
+            bottom: 0;
+            background: rgba(0, 0, 0, 0.8);
+            filter: alpha(opacity=80);
+            height: 100%;
+            width: 100%;
+            z-index: 100;
+        }
+
+        .weixin-tip p {
+            text-align: center;
+            margin-top: 10%;
+            padding: 0 5%;
+        }
+
+        * {
+            padding: 0;
+            margin: 0;
+            box-sizing: border-box
+        }
+
+    </style>
+</head>
+<body>
+<div class="div">
+    <img class="img" src="/static/img/down.jpg"/>
+    <a href="{$apk}" downLoad="易趣G.apk">
+        <div class="button">Android版本下载</div>
+    </a>
+</div>
+<div class="weixin-tip">
+    <p>
+        <img src="/static/img/live_weixin.png" alt="微信打开"/>
+    </p>
+</div>
+</body>
+<script>
+    $(window).on("load", function () {
+        var winHeight = $(window).height();
+
+        function is_weixin() {
+            var ua = navigator.userAgent.toLowerCase();
+            if (ua.match(/MicroMessenger/i) == "micromessenger") {
+                return true;
+            } else {
+                return false;
+            }
+        }
+
+        var isWeixin = is_weixin();
+        if (isWeixin) {
+            $(".weixin-tip").css("height", winHeight);
+            $(".weixin-tip").show();
+        }
+    })
+</script>
+</html>

+ 210 - 0
app/register/view/index/index.html

@@ -0,0 +1,210 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+    <meta charset="UTF-8">
+    <meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=no"/>
+    <meta name="misapplication-tap-highlight" content="no"/>
+    <meta name="HandheldFriendly" content="true"/>
+    <meta name="MobileOptimized" content="320"/>
+    <script src="https://cdn.bootcss.com/blueimp-md5/2.10.0/js/md5.js"></script>
+    <script typet="text/javascript" src="http://libs.baidu.com/jquery/1.9.1/jquery.min.js"></script>
+</head>
+<body>
+<div class="container">
+    <div class="loginTitle">欢迎注册喜嗨购</div>
+    <div class="loginText">请认真填写个人信息</div>
+    <div class="login-box">
+        <div class="username">账号</div>
+        <input class="input-box" type="email" id="phone" name="phone" placeholder="请输入手机号"/>
+    </div>
+    <div class="login-box">
+        <div class="username">验证码</div>
+        <div class="flex">
+            <input class="input-box" style="width: 50%" id="code" type="number" name="code" placeholder="请输入验证码">
+            <div class="code" id="daojishi" onclick="verification()">发送验证码</div>
+        </div>
+    </div>
+    <div class="login-box">
+        <div class="username">登录密码</div>
+        <input class="input-box" id="loginPass" type="password" name="loginPass" placeholder="请输入登录密码">
+    </div>
+    <div class="login-box">
+        <div class="username">邀请码</div>
+        <input class="input-box" id="invitation" type="text" disabled="disabled" name="invitation" placeholder="请输入邀请码">
+    </div>
+    <div class="flex">
+        <div class="login" onclick="fnLogin()">注册</div>
+        <div class="login"><a href="{:url('down')}">下载APP</a></div>
+    </div>
+</div>
+</body>
+<script type="text/javascript">
+    var url = location.search;
+    if (url.indexOf("?") != -1) {
+        var str = url.substr(1);
+        strs = str.split("=");
+        var invitation = strs[1];
+        document.getElementById('invitation').value = invitation;
+    }
+
+    function fnLogin() {
+        var phone = document.getElementById("phone").value;
+        var loginPass = document.getElementById("loginPass").value;
+        var code = document.getElementById("code").value;
+        var invitation = document.getElementById("invitation").value;
+        if (phone == '') {
+            window.alert("请输入账号");
+            return false;
+        }
+        if (code == '') {
+            window.alert("请输入验证码");
+            return false;
+        }
+        if (loginPass == '') {
+            window.alert("请输入登录密码");
+            return false;
+        }
+        if (invitation == '') {
+            window.alert("请输入邀请码");
+            return false;
+        }
+        $.ajax({
+            type: "post",
+            url: "http://yg.hqgjsmc.com/api/register",
+            data: {account: phone, captcha: code, password: loginPass, spread: invitation},
+            dataType: "json",
+            success: function (data) {
+                window.alert(data.msg);
+                if (data.msg === '注册成功')
+                    window.location.href = "{:url('down')}"
+            }
+        });
+    }
+
+    function verification() {
+        var phone = document.getElementById("phone").value;
+        if (phone == '') {
+            window.alert("请输入手机号");
+            return false;
+        }
+        if (!/^1[3|4|5|6|7|8|9]\d{9}$/.test(phone)) {
+            window.alert('请输入正确的手机号');
+            return;
+        }
+
+        var timer = null;
+        var count = 60;
+        var codeText = $('#daojishi').text();
+
+        if (codeText == '发送验证码') {
+            timer = setInterval(function () {
+                count--;
+                $('#daojishi').text(count);
+                if (count <= 0) {
+                    clearInterval(timer);
+                    $('#daojishi').text('发送验证码');
+                }
+            }, 1000);
+        }
+        if (codeText != '发送验证码') {
+            return
+        }
+        $.ajax({
+            type: "post",
+            url: "http://yg.hqgjsmc.com/api/register/verify",
+            data: {phone: phone, type: 'register'},
+            dataType: "json",
+            success: function (data) {
+                window.alert(data.msg);
+
+            }
+        });
+    }
+</script>
+<style type="text/css">
+    * {
+        margin: 0;
+        padding: 0;
+        font-family: 微软雅黑;
+        font-size: 12px;
+        min-height: 100%;
+    }
+
+    .container {
+        padding: 10% 30px 0px 30px;
+    }
+
+    .loginTitle {
+        font-weight: bold;
+        color: #32baff;
+        font-size: 29px;
+        padding-bottom: 25px;
+    }
+
+    .loginText {
+        font-weight: 500;
+        color: #333333;
+        font-size: 17px;
+        margin-bottom: 15px;
+    }
+
+    .login-box {
+        width: 100%;
+        font-size: 16px;
+        padding-top: 15px;
+    }
+
+    .username {
+        display: block;
+        padding-bottom: 12px;
+        font-weight: 500;
+        color: #333333;
+        font-size: 16px;
+
+    }
+
+    .input-box {
+        border: none;
+        padding: 10px 8px;
+        outline: none;
+        width: 100%;
+        background-color: #F5F5F5;
+        border-radius: 9px;
+        color: #32baff;
+    }
+
+    .input-box::placeholder {
+        color: #bbbbbb;
+    }
+
+    .code {
+        background-color: #32baff;
+        border-radius: 5px;
+        font-weight: 500;
+        color: #FFFFFF;
+        font-size: 13px;
+        padding: 6px 8px;
+    }
+
+    .login {
+        background-color: #32baff;
+        color: #FFFFFF;
+        text-align: center;
+        width: 130px;
+        line-height: 40px;
+        border-radius: 25px;
+        margin-top: 30px;
+    }
+
+    .login > a {
+        color: #FFFFFF;
+        text-decoration: none;
+    }
+
+    .flex {
+        display: flex;
+        align-items: center;
+        justify-content: space-between;
+    }
+</style>
+</html>

+ 1 - 1
config/app.php

@@ -27,7 +27,7 @@ return [
     // 自动多应用模式
     'auto_multi_app' => true,
     // 应用映射(自动多应用模式有效)
-    'app_map' => ['*' => '', 'api' => 'api', 'admin' => 'admin', 'wap' => 'wap'],
+    'app_map' => ['*' => '', 'api' => 'api', 'admin' => 'admin', 'wap' => 'wap', 'register' => 'register'],
     // 域名绑定(自动多应用模式有效)
     'domain_bind' => [],
     // 禁止URL访问的应用列表(自动多应用模式有效)

BIN
public/static/img/down.jpg


BIN
public/static/img/downLoad.png


BIN
public/static/img/live_weixin.png


+ 1 - 0
route/api/route.php

@@ -32,6 +32,7 @@ Route::any('wechat/serve', 'wechat.WechatController/serve');//公众号服务
 Route::any('wechat/notify', 'wechat.WechatController/notify');//公众号支付回调
 Route::any('routine/notify', 'wechat.AuthController/notify');//小程序支付回调
 Route::any('adapay/notify', 'AdaPayController/notify');//第三方回调
+Route::any('adapay/cz_notify', 'AdaPayController/cz_notify');//第三方充值回调
 
 //管理员订单操作类
 Route::group(function () {