root 9 年之前
父节点
当前提交
520328579f
共有 2 个文件被更改,包括 46 次插入0 次删除
  1. 42 0
      mobile/control/config.php
  2. 4 0
      mobile/util/errcode.php

+ 42 - 0
mobile/control/config.php

@@ -0,0 +1,42 @@
+<?php
+/**
+ * 更新
+ */
+
+defined('InShopNC') or exit('Access Invalid!');
+
+class configControl extends mobileHomeControl
+{
+    public function __construct()
+    {
+        parent::__construct();
+    }
+
+    /**
+     * 获取配置文件
+     *
+     * 参数: platform 1:android 2:ios
+     */
+    public function getconfigOp()
+    {
+        $platform = trim($_GET['platform']);
+        $ver_code = trim($_GET['ver_code']);
+        if (!isset($platform) || empty($platform)) {
+            return joutput_error(errcode::ErrInputParam);
+        }
+        if (!isset($ver_code) || empty($ver_code)) {
+            return joutput_error(errcode::ErrInputParam);
+        }
+
+        $result = Model()->table('config')->select();
+        if (empty($result)) {
+            return joutput_error(errcode::ErrGetConfig);
+        } else {
+            $ret = array();
+            foreach ($result as $value) {
+                $ret[$value['name']] = array('value'=>$value['value']);
+            }
+        }
+        return joutput_data($ret);
+    }
+}

+ 4 - 0
mobile/util/errcode.php

@@ -52,6 +52,8 @@ class errcode extends SplEnum
     const ErrWxNotExist = 13005;
     const ErrLoginType = 13006;
 
+    const ErrGetConfig = 14000;
+
 
     static function msg($code)
     {
@@ -111,6 +113,8 @@ class errcode extends SplEnum
                 return '商品库存不足';
             case errcode::ErrAddCart:
                 return '添加购物车失败';
+            case errcode::ErrGetConfig:
+                return '获取配置文件出错';
 
             case errcode::ErrDB :
                 return '系统错误';