Authored by yyq

fix

@@ -43,7 +43,7 @@ module.exports = { @@ -43,7 +43,7 @@ module.exports = {
43 codeGain(req, res, next) { 43 codeGain(req, res, next) {
44 let params = req.body; 44 let params = req.body;
45 45
46 - if (!params.uid || !params.actPrizeId || !params.userName || !params.userThumb) { 46 + if (!params.uid || !params.actPrizeId || !params.userName || !params.userThumb || !params.unionId) {
47 return res.json({ 47 return res.json({
48 code: 400, 48 code: 400,
49 message: '参数非法' 49 message: '参数非法'
@@ -694,7 +694,7 @@ class AdminModel extends global.yoho.BaseModel { @@ -694,7 +694,7 @@ class AdminModel extends global.yoho.BaseModel {
694 let contentKey = `content${index}`; 694 let contentKey = `content${index}`;
695 let sortKey = `sort${index}`; 695 let sortKey = `sort${index}`;
696 696
697 - unionParams[typeKey] = value.type; 697 + unionParams[typeKey] = value.type || 1;
698 unionParams[contentKey] = value.content; 698 unionParams[contentKey] = value.content;
699 unionParams[sortKey] = value.sort; 699 unionParams[sortKey] = value.sort;
700 700
@@ -704,7 +704,7 @@ class AdminModel extends global.yoho.BaseModel { @@ -704,7 +704,7 @@ class AdminModel extends global.yoho.BaseModel {
704 if (union.length) { 704 if (union.length) {
705 mysqlCli.insert(`insert into ${TABLE_ACT_PRIZE_PRODUCT_CONTENT} ( 705 mysqlCli.insert(`insert into ${TABLE_ACT_PRIZE_PRODUCT_CONTENT} (
706 act_prize_id, floor_type, content, sort) 706 act_prize_id, floor_type, content, sort)
707 - ${union.join(' union all')}`, unionParams); 707 + ${union.join(' union all ')}`, unionParams);
708 } 708 }
709 } 709 }
710 710
@@ -740,6 +740,8 @@ class AdminModel extends global.yoho.BaseModel { @@ -740,6 +740,8 @@ class AdminModel extends global.yoho.BaseModel {
740 userList.push(value.union_id); 740 userList.push(value.union_id);
741 }); 741 });
742 742
  743 + userList = _.uniq(userList);
  744 +
743 if (!userList.length) { 745 if (!userList.length) {
744 return Promise.resolve(); 746 return Promise.resolve();
745 } 747 }
@@ -753,7 +755,7 @@ class AdminModel extends global.yoho.BaseModel { @@ -753,7 +755,7 @@ class AdminModel extends global.yoho.BaseModel {
753 activityTime: moment().format('YYYY-MM-DD HH:mm') + ':00', 755 activityTime: moment().format('YYYY-MM-DD HH:mm') + ':00',
754 pageUrl: '/page/subPackage/pages/zeroSell/detail?actPrizeId=' + id 756 pageUrl: '/page/subPackage/pages/zeroSell/detail?actPrizeId=' + id
755 }), 757 }),
756 - uidList: _.uniq(userList) 758 + uidList: userList
757 } 759 }
758 }); 760 });
759 } 761 }
@@ -102,33 +102,35 @@ @@ -102,33 +102,35 @@
102 <div> 102 <div>
103 <div class="col-md-6 col-md-offset-3 floor-view-box"> 103 <div class="col-md-6 col-md-offset-3 floor-view-box">
104 {{# content}} 104 {{# content}}
105 - <div class="floor-item"  
106 - data-id="{{id}}"  
107 - data-sort="{{sort}}"  
108 - data-content="{{content}}"  
109 - {{#isEqualOr floor_type 1}}  
110 - data-type="text"> 105 + {{#if floor_type}}
  106 + <div class="floor-item"
  107 + data-id="{{id}}"
  108 + data-sort="{{sort}}"
  109 + data-content="{{content}}"
  110 + {{#isEqualOr floor_type 1}}
  111 + data-type="text">
111 112
112 - <p class="item-content">{{content}}</p  
113 - {{/isEqualOr}}  
114 - {{#isEqualOr floor_type 2}}  
115 - data-type="img">  
116 - <img src="{{content}}" class="item-content"  
117 - {{/isEqualOr}}  
118 - {{#isEqualOr floor_type 3}}  
119 - data-type="video">  
120 - <video src="{{content}}" class="item-content">  
121 - 您的浏览器不支持 video 标签。  
122 - </video>  
123 - {{/isEqualOr}}  
124 - > 113 + <p class="item-content">{{content}}</p
  114 + {{/isEqualOr}}
  115 + {{#isEqualOr floor_type 2}}
  116 + data-type="img">
  117 + <img src="{{content}}" class="item-content"
  118 + {{/isEqualOr}}
  119 + {{#isEqualOr floor_type 3}}
  120 + data-type="video">
  121 + <video src="{{content}}" class="item-content">
  122 + 您的浏览器不支持 video 标签。
  123 + </video>
  124 + {{/isEqualOr}}
  125 + >
125 126
126 - <div class="option-btns">  
127 - <span class="glyphicon glyphicon-arrow-up up-item-btn"></span>  
128 - <span class="glyphicon glyphicon-arrow-down down-item-btn"></span> 127 + <div class="option-btns">
  128 + <span class="glyphicon glyphicon-arrow-up up-item-btn"></span>
  129 + <span class="glyphicon glyphicon-arrow-down down-item-btn"></span>
  130 + </div>
  131 + <span class="del-item-btn">删除</span>
129 </div> 132 </div>
130 - <span class="del-item-btn">删除</span>  
131 - </div> 133 + {{/if}}
132 {{/ content}} 134 {{/ content}}
133 </div> 135 </div>
134 <div class="col-md-6 col-md-offset-3"> 136 <div class="col-md-6 col-md-offset-3">
@@ -46,7 +46,7 @@ @@ -46,7 +46,7 @@
46 <td class="text-center">{{limit}}</td> 46 <td class="text-center">{{limit}}</td>
47 <td class="text-center">{{sort}}</td> 47 <td class="text-center">{{sort}}</td>
48 <td class="text-center"> 48 <td class="text-center">
49 - <image src="{{cover_img}}"> 49 + <image src="{{cover_img}}" class="cover-img">
50 </td> 50 </td>
51 <td class="text-center"> 51 <td class="text-center">
52 {{# btns}} 52 {{# btns}}
@@ -52,6 +52,7 @@ @@ -52,6 +52,7 @@
52 <li><a href="/admin/activity/list">活动列表</a></li> 52 <li><a href="/admin/activity/list">活动列表</a></li>
53 <li><a href="/admin/activity/create">活动创建</a></li> 53 <li><a href="/admin/activity/create">活动创建</a></li>
54 <li><a href="/admin/activity/upload_excel">上传Y100excel</a></li> 54 <li><a href="/admin/activity/upload_excel">上传Y100excel</a></li>
  55 + <li><a href="/admin/activity/zerobuy">0元购</a></li>
55 </ul> 56 </ul>
56 </li> 57 </li>
57 <li><a><i class="fa fa-users"></i> 用户管理 <span class="fa fa-chevron-down"></span></a> 58 <li><a><i class="fa fa-users"></i> 用户管理 <span class="fa fa-chevron-down"></span></a>
@@ -188,6 +188,7 @@ function bindEditPageEvent() { @@ -188,6 +188,7 @@ function bindEditPageEvent() {
188 188
189 if (!item.id) { 189 if (!item.id) {
190 newFloors.push({ 190 newFloors.push({
  191 + type: typeNum[item.type] || 1,
191 content: item.newContent, 192 content: item.newContent,
192 sort: index 193 sort: index
193 }); 194 });
@@ -258,6 +259,11 @@ function bindEditPageEvent() { @@ -258,6 +259,11 @@ function bindEditPageEvent() {
258 $floorBox.children('.floor-item').each(() => { 259 $floorBox.children('.floor-item').each(() => {
259 let $this = $(this); 260 let $this = $(this);
260 let data = $this.data(); 261 let data = $this.data();
  262 +
  263 + if (!data) {
  264 + return;
  265 + }
  266 +
261 let cid = generateCid(data.id); 267 let cid = generateCid(data.id);
262 268
263 $this.data('cid', cid); 269 $this.data('cid', cid);
1 @import '~bootstrap-daterangepicker'; 1 @import '~bootstrap-daterangepicker';
2 2
  3 +.cover-img {
  4 + width: 160px;
  5 +}
  6 +
3 .floor-view-box { 7 .floor-view-box {
4 min-height: 300px; 8 min-height: 300px;
5 border: 1px solid #ccc; 9 border: 1px solid #ccc;