root 9 anni fa
parent
commit
597382d491
3 ha cambiato i file con 72 aggiunte e 6 eliminazioni
  1. 10 6
      data/model/bonus_type.model.php
  2. 19 0
      data/model/patch.model.php
  3. 43 0
      mobile/control/patch.php

+ 10 - 6
data/model/bonus_type.model.php

@@ -7,24 +7,28 @@
 
 defined('InShopNC') or exit('Access Invalid!');
 
-class bonus_typeModel extends Model {
+class bonus_typeModel extends Model
+{
     public function __construct()
     {
         parent::__construct('bonus_type');
     }
 
-    public function getAll(){
+    public function getAll()
+    {
         return $this->select();
     }
 
-    public function get($id){
+    public function get($id)
+    {
         return $this->where(array('type_id' => $id))->select();
     }
 
-    public function save($data, &$id){
-        if($id > 0){
+    public function save($data, &$id)
+    {
+        if ($id > 0) {
             $this->where(array('type_id' => $id))->update($data);
-        }else{
+        } else {
             $id = $this->insert($data);
         }
     }

+ 19 - 0
data/model/patch.model.php

@@ -0,0 +1,19 @@
+<?php
+/**
+ * 补丁
+ */
+
+defined('InShopNC') or exit('Access Invalid!');
+
+class patchModel extends Model
+{
+    public function __construct()
+    {
+        parent::__construct('patch');
+    }
+
+    public function getSingleItemByVerName($condition)
+    {
+        return $this->where($condition)->limit(1)->find();
+    }
+}

+ 43 - 0
mobile/control/patch.php

@@ -0,0 +1,43 @@
+<?php
+
+/**
+ * Created by PhpStorm.
+ * User: dell
+ * Date: 2016/2/29
+ * Time: 14:17
+ */
+class patchControl extends mobileHomeControl
+{
+    public function __construct()
+    {
+        parent::__construct();
+    }
+
+    public function getpatchOp()
+    {
+        $version = trim($_GET['version']);
+        if (!isset($version) || empty($version)) {
+            joutput_error(errcode::ErrInputParam);
+        }
+
+        $condition = array();
+        $condition['ver_name'] = $version;
+        $condition['enable'] = 1;
+
+        $model = Model('patch');
+        $result = $model->getSingleItemByVerName($condition);
+
+        $ret = array();
+        if (!empty($result)) {
+            $ret['version'] = $version;
+            $ret['patch_code'] = $result['patch_code'];
+            $ret['patch_url'] = $result['patch_url'];
+        } else {
+            $ret['version'] = $version;
+        }
+
+        joutput_data($ret);
+    }
+}
+
+