pengchanglu пре 3 година
родитељ
комит
61f2622e90

+ 5 - 3
application/admin/controller/pig/Codecreate.php

@@ -111,11 +111,13 @@ class Codecreate extends Backend
      */
     public function download()
     {
+        $url = 'http://pig.viicb.com/index/index/code.html?code=';
         $co_id = $params = $this->request->request("co_id");
         if (!$co_id) {
             $this->error('co_id为空!');
         }
-        $list = $this->model->where('co_id', $co_id)->column('id')->select();
+        $model = new \app\admin\model\pig\Code;
+        $list = $model->where('co_id', $co_id)->column('id');
 
         set_time_limit(0);
         ini_set('memory_limit', '512M');
@@ -125,10 +127,10 @@ class Codecreate extends Backend
         header("Content-Disposition:attachment;filename=" . $co_id ."-code-" . date("Y-m-d") . ".csv");
         ob_end_clean();
 
-        echo 'ID,URL\n';
+        echo 'ID,URL'."\n";
 
         foreach ($list as $k => $v) {
-            echo $k+1,','.encrypt($v).'\n';
+            echo $k+1,','.$url.encrypt(str_pad($v, 8, '0', STR_PAD_LEFT))."\n";
             // code...
         }
         exit;

+ 3 - 2
application/index/controller/Index.php

@@ -27,8 +27,9 @@ class Index extends Frontend
             $this->error("CODE为空,非法访问!");
             exit;
         }
-        $id = decrypt($code);
-        $id = 1;
+        $id = intval(decrypt($code));
+        //$id = 1;
+        echo $id;
         $code = new Code();
         $codeinfo = $code->find($id);
         if (!$codeinfo) {