dever 6 years ago
parent
commit
a2d7835386

+ 11 - 1
code/database/config.php

@@ -76,13 +76,23 @@ return array
 		'product_num'		=> array
 		(
 			'type' 		=> 'varchar-32',
-			'name' 		=> '兑换本数',
+			'name' 		=> '兑换本数-填写0则不增加售出本数',
 			'default' 	=> '1',
 			'desc' 		=> '兑换本数',
 			'match' 	=> 'is_string',
 			'update'	=> 'text',
 		),
 
+		'score'         => array
+        (
+            'type'      => 'varchar-80',
+            'name'      => '增加积分数-直接填写积分数,设置之后,积分规则里的设置及小刊兑换码中的设置将失效',
+            'default'   => '',
+            'desc'      => '增加积分数',
+            'match'     => 'is_string',
+            'update'    => 'text',
+        ),
+
 		'cdate'		=> array
 		(
 			'type' 		=> 'int-11',

+ 11 - 1
code/database/info.php

@@ -106,7 +106,7 @@ return array
 			'update'	=> 'select',
 			'option'	=> $product,
 			//'search'	=> 'select',
-			'list'		=> true,
+			'list'		=> '{product_id} > 0 ? Dever::load("journal/info-one#name", {product_id}) : "通用"',
 		),
 
 		'code'		=> array
@@ -122,6 +122,16 @@ return array
 			'list'		=> true,
 		),
 
+		'score'         => array
+        (
+            'type'      => 'varchar-80',
+            'name'      => '增加积分数-直接填写积分数,设置之后,积分规则里的设置及小刊兑换码中的设置将失效',
+            'default'   => '',
+            'desc'      => '增加积分数',
+            'match'     => 'is_string',
+            //'update'    => 'text',
+        ),
+
 		'product_num'      => array
         (
             'type'      => 'int-11',

+ 5 - 2
code/lib/Core.php

@@ -6,13 +6,13 @@ use Dever;
 
 class Core
 {
-	public function createCode($product, $cate_id, $product_id, $seller_id, $product_num = 1, $create_uid = -1, $order_id = false)
+	public function createCode($product, $cate_id, $product_id, $seller_id, $product_num = 1, $create_uid = -1, $order_id = false, $score = 0)
 	{
 		$code = Dever::rand(8, 0);
 		$data['code'] = $code;
 		$total = Dever::db('code/info')->total($data);
 		if ($total > 0) {
-			return $this->createCode($product, $cate_id, $product_id, $seller_id, $product_num, $create_uid, $order_id);
+			return $this->createCode($product, $cate_id, $product_id, $seller_id, $product_num, $create_uid, $order_id, $score);
 		}
 		
 		//$data['product'] = $product;
@@ -27,6 +27,9 @@ class Core
 		if ($create_uid > 0) {
 			$data['create_uid'] = $create_uid;
 		}
+		if ($score > 0) {
+			$data['score'] = $score;
+		}
 		Dever::db('code/info')->insert($data);
 		return $code;
 	}

+ 10 - 5
code/lib/Manage.php

@@ -38,22 +38,27 @@ class Manage
 	public function create($id, $name, $param)
 	{
 		$code = Dever::param('num', $param);
+		$score = Dever::param('score', $param);
 		$product_num = Dever::param('product_num', $param);
 		$product = Dever::param('product', $param);
 		//$product_id = Dever::param('product_id', $param);
 		$seller_id = Dever::param('seller_id', $param);
 
 		$cate_id = $product_id = 0;
-		if ($product && isset($product[0]) && isset($product[1])) {
+		if ($product && isset($product[0])) {
 			$cate_id = $product[0];
-			$product_id = $product[1];
+			if (isset($product[1])) {
+				$product_id = $product[1];
+			}
+			
 			$product = implode(',', $product);
 		}
 
-		if ($cate_id <= 0 || $product_id <= 0){
-			Dever::alert('生成失败');
+		if ($cate_id <= 0){
+			Dever::alert('生成失败,请选择分类');
 		}
 
+
 		//$total = Dever::db('code/info')->total(array('product_id' => $product_id, 'type' => 1));
 		$total = 0;
 		$core = Dever::load('code/lib/core');
@@ -61,7 +66,7 @@ class Manage
 			$num = $code - $total;
 
 			for ($i = 0; $i < $num; $i++) {
-				$core->createCode($product, $cate_id, $product_id, $seller_id, $product_num);
+				$core->createCode($product, $cate_id, $product_id, $seller_id, $product_num, -1, false, $score);
 			}
 		}
 	}

+ 1 - 0
doc/apidoc.php

@@ -1088,6 +1088,7 @@
  * @apiSuccess {String}   content.video 视频地址。type=4,5时有效
  * @apiSuccess {String}   content.music 音频地址。type=6时有效
  * @apiSuccess {String}   content.pic 全屏图或者长图,type=1,2,7,8,9时有效
+ * @apiSuccess {String}   content.pic_info 全屏图或者长图的图片信息,type=1,2,7,8,9时有效,值如1024_768_548.12_35,请用_分隔成数组使用,1024为宽度,768为高度,548.12为图片大小,35为图片id
  * @apiSuccess {String}   content.is_button 全屏图上的保存按钮,1显示2不显示,type=1时有效
  * @apiSuccess {String}   content.button_name 全屏图上的保存按钮的文字,type=1时有效
  * @apiSuccess {String}   content.button_color 全屏图上的保存按钮的文字颜色,type=1时有效

+ 2 - 2
h5/assets/mobile/article.html

@@ -27,7 +27,7 @@
         <{if($v['type'] == 1):}>
         <{if(isset($v['content'])):}>
         <{$v['content']}>
-        <{/if}>
+        <{endif}>
 
         <{elseif($v['type'] == 2):}>
           <!--视频-->
@@ -146,7 +146,7 @@
               <span><{$v1['time']}></span>
             </div>
             <div class='p'>
-              <span><{$v1['content']}></span>
+              <span><{if(isset($v1['content'])):}><{$v1['content']}><{endif}></span>
             </div>
           </div>
         </div>

+ 10 - 0
journal/database/content.php

@@ -322,6 +322,16 @@ return array
             'show'      => 'type=1,2,7,8,9',      
         ),
 
+        'pic_info'        => array
+        (
+            'type'      => 'varchar-500',
+            'name'      => '图片信息',
+            'default'   => '',
+            'desc'      => '图片信息',
+            'match'     => 'is_string',
+            'update'    => 'text',
+        ),
+
         'is_button'     => array
         (
             'type'      => 'int-11',

+ 9 - 2
main/src/Journal.php

@@ -1013,7 +1013,7 @@ class Journal extends Core
 
             $product = Dever::db('journal/info')->one($journal_id);
 
-            $info = Dever::db('code/info')->one(array('product_id' => $journal_id, 'code' => $code));
+            $info = Dever::db('code/info')->one(array('code' => $code));
 
             if (!$info) {
                 Dever::alert('兑换码不存在');
@@ -1031,6 +1031,10 @@ class Journal extends Core
                 //Dever::alert('兑换码已被领取');
             }
 
+            if ($info['product_id'] > 0 && $info['product_id'] != $journal_id) {
+                Dever::alert('请正确使用小刊兑换码');
+            }
+
             $order = Dever::db('journal/order')->one(array('product_id' => $journal_id, 'code' => $code, 'type' => 2, 'uid' => $this->data['uid']));
 
             if ($order) {
@@ -1060,13 +1064,16 @@ class Journal extends Core
 
             $score = false;
             $num = false;
-            if (isset($info['product_num']) && $info['product_num'] > 0) {
+            if (isset($info['score']) && $info['score'] > 0) {
+                $score = $info['score'];
+            } elseif (isset($info['product_num']) && $info['product_num'] > 0) {
                 if ($product && $product['dh_score'] > 0) {
                     $score = $info['product_num'] * $product['dh_score'];
                 } elseif ($product) {
                     $num = $info['product_num'];
                 }
             }
+
             # 增加积分
             Dever::score($this->data['uid'], 'dh_journal', '兑换小刊', 'act/lib/score.submit?method=code&type=4&id=' . $journal_id, $score, $num);
 

+ 1 - 0
source/lib/Core.php

@@ -37,6 +37,7 @@ class Core
      */
     public function save($uid, $type, $source_id, $log = array())
     {
+        return;
     	$log += Dever::input();
         $url = Dever::url();
 

+ 3 - 3
stat/database/source.php

@@ -189,7 +189,7 @@ $config = array
             'match'     => '落地页PV',
             'match'     => 'is_numeric',
             'update'    => 'text',
-            'list'      => true,
+            //'list'      => true,
         ),
 
         'uv'       => array
@@ -200,7 +200,7 @@ $config = array
             'match'     => '落地页UV',
             'match'     => 'is_numeric',
             'update'    => 'text',
-            'list'      => true,
+            //'list'      => true,
         ),
 
         'user_num'       => array
@@ -222,7 +222,7 @@ $config = array
             'match'     => '用户授权量',
             'match'     => 'is_numeric',
             'update'    => 'text',
-            'list'      => true,
+            //'list'      => true,
         ),
 
         'order_num'       => array

+ 2 - 1
stat/lib/Source.php

@@ -45,7 +45,8 @@ class Source
         		for ($i = 0; $i < $num; $i++) {
         			$where['start'] = strtotime("$start -$i day");
 	                $where['end'] = $where['start'] + 86399;
-	                $log = Dever::load('source/lib/core')->get(date('Y_m_d', $where['start']), 'list', $sv['id'], $where['start'], $where['end']);
+	                //$log = Dever::load('source/lib/core')->get(date('Y_m_d', $where['start']), 'list', $sv['id'], $where['start'], $where['end']);
+                    $log['pv'] = $log['uv'] = $log['user_num'] = $log['user_yes_num'] = 0;
         			foreach ($journal as $k => $v) {
 	                    $this->total($sv, $v, $where, $log['pv'], $log['uv'], $log['user_num'], $log['user_yes_num']);
 		            }