Storesnstracelog.php 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  1. <?php
  2. namespace app\common\model;
  3. use think\facade\Db;
  4. /**
  5. * ============================================================================
  6. *
  7. * ============================================================================
  8. * 版权所有 2014-2028 浙江惠利玛产业互联网有限公司,并保留所有权利。
  9. * 网站地址: https://www.valimart.net/
  10. * ----------------------------------------------------------------------------
  11. *
  12. * ============================================================================
  13. * 数据层模型
  14. */
  15. class Storesnstracelog extends BaseModel
  16. {
  17. public $page_info;
  18. /**
  19. * 店铺动态列表
  20. * @access public
  21. * @author csdeshang
  22. * @param array $condition 条件
  23. * @param string $field 字段
  24. * @param string $order 排序
  25. * @param int $limit 限制
  26. * @param int $pagesize 分页
  27. * @return array
  28. */
  29. public function getStoresnstracelogList($condition, $field = '*', $order = 'stracelog_id desc',$limit = 0, $pagesize = 0) {
  30. if($pagesize) {
  31. $res = Db::name('storesnstracelog')->where($condition)->field($field)->order($order)->paginate(['list_rows'=>$pagesize,'query' => request()->param()],false);
  32. $this->page_info=$res;
  33. return $res->items();
  34. }else{
  35. return Db::name('storesnstracelog')->where($condition)->field($field)->order($order)->limit($limit)->select()->toArray();
  36. }
  37. }
  38. /**
  39. * 获得店铺动态总数
  40. * @access public
  41. * @author csdeshang
  42. * @param array $condition 条件
  43. * @return int
  44. */
  45. public function getStoresnstracelogCount($condition) {
  46. return Db::name('storesnstracelog')->where($condition)->count();
  47. }
  48. /**
  49. * 获取单条店铺动态
  50. * @access public
  51. * @author csdeshang
  52. * @param array $condition 条件
  53. * @return array
  54. */
  55. public function getStoresnstracelogInfo($condition) {
  56. return Db::name('storesnstracelog')->where($condition)->find();
  57. }
  58. /**
  59. * 保存店铺动态
  60. * @access public
  61. * @author csdeshang
  62. * @param array $data 数据
  63. * @return boolean
  64. */
  65. public function addStoresnstracelog($data) {
  66. return Db::name('storesnstracelog')->insertGetId($data);
  67. }
  68. /**
  69. * 保存店铺动态
  70. * @access public
  71. * @author csdeshang
  72. * @param array $data 数据
  73. * @return boolean
  74. */
  75. public function addStoresnstracelogAll($data) {
  76. return Db::name('storesnstracelog')->insertAll($data);
  77. }
  78. /**
  79. * 更新店铺动态
  80. * @access public
  81. * @author csdeshang
  82. * @param array $update 更新数据
  83. * @param array $condition 条件
  84. * @return boolean
  85. */
  86. public function editStoresnstracelog($update, $condition) {
  87. return Db::name('storesnstracelog')->where($condition)->update($update);
  88. }
  89. /**
  90. * 删除店铺动态
  91. * @access public
  92. * @author csdeshang
  93. * @param array $condition 条件
  94. * @return boolean
  95. */
  96. public function delStoresnstracelog($condition) {
  97. return Db::name('storesnstracelog')->where($condition)->delete();
  98. }
  99. /**
  100. * 拼写个类型样式
  101. * @param type $type 动态类型
  102. * @param type $data 相关数据
  103. * @return string
  104. */
  105. public function spellingStyle($type,$data){
  106. //1'relay',2'normal',3'new',4'coupon',5'xianshi',6'mansong',7'bundling',8'groupbuy',9'recommend',10'hotsell'
  107. $rs = '';
  108. switch ($type){
  109. case '2':
  110. break;
  111. case '3':
  112. $rs = "<div class=\"fd-media\">
  113. <div class=\"goodsimg\"><a target=\"_blank\" href=\"" . (string)url('home/Goods/index', array('goods_id'=>$data['goods_id'])) . "\"><img src=\"" . goods_cthumb($data['goods_image'], 240, $data['store_id']) . "\" onload=\"javascript:ResizeImage(this,120,120);\" alt=\"" . $data['goods_name'] . "\"></a></div>
  114. <div class=\"goodsinfo\">
  115. <dl>
  116. <dt><i class=\"desc-type desc-type-new\">" . lang('store_sns_new_selease') . "</i><a target=\"_blank\" href=\"" . (string)url('home/Goods/index', array('goods_id'=>$data['goods_id'])) . "\">" . $data['goods_name'] . "</a></dt>
  117. <dd>" . lang('sns_sharegoods_price') . lang('ds_colon') . lang('currency') . ds_price_format($data['goods_price']) . "</dd>
  118. <dd>" . ((isset($data['goods_transfee_charge']) && $data['goods_transfee_charge'] == '1') ? lang('store_sns_free_shipping') : lang('sns_sharegoods_freight') . lang('ds_colon') . lang('currency') . ds_price_format($data['goods_freight'])) . "</dd>
  119. <dd dstype=\"collectbtn_" . $data['goods_id'] . "\"><a href=\"javascript:void(0);\" onclick=\"javascript:collect_goods('" . $data['goods_id'] . "','succ','collectbtn_" . $data['goods_id'] . "');\">" . lang('sns_sharegoods_collect') . "</a></dd>
  120. </dl>
  121. </div>
  122. </div>";
  123. break;
  124. case '4':
  125. $rs = "<div class=\"fd-media\">
  126. <div class=\"goodsimg\"><a target=\"_blank\" href=\"" . (string)url('Coupon_store/detail', array('coupon_id' => $data['coupon_id'], 'id' => $data['store_id'])) . "\"><img src=\"" . $data['coupon_pic'] . "\" onerror=\"this.src='" . HOME_SITE_ROOT . "/images/default_coupon_image.png'\" onload=\"javascript:ResizeImage(this,120,120);\" alt=\"" . $data['coupon_title'] . "\"></a></div>
  127. <div class=\"goodsinfo\">
  128. <dl>
  129. <dt><i class=\"desc-type desc-type-coupon\">" . lang('store_sns_coupon') . "</i><a target=\"_blank\" href=\"" . (string)url('Coupon_store/detail', array('coupon_id' => $data['coupon_id'], 'id' => $data['store_id'])) . "\">" . $data['coupon_title'] . "</a></dt>
  130. <dd>" . lang('store_sns_coupon_price') . lang('ds_colon') . lang('currency') . ds_price_format($data['coupon_price']) . "</dd>
  131. <dd>" . lang('store_sns_start-stop_time') . lang('ds_colon') . date('Y-m-d H:i', $data['coupon_start_date']) . "~" . date('Y-m-d H:i', $data['coupon_end_date']) . "</dd>
  132. </dl>
  133. </div>
  134. </div>";
  135. break;
  136. case '5':
  137. $rs = "<div class=\"fd-media\">
  138. <div class=\"goodsimg\"><a target=\"_blank\" href=\"" . (string)url('home/Goods/index', array('goods_id'=>$data['goods_id'])) . "\"><img src=\"" . goods_cthumb($data['goods_image'], 240,$data['store_id']) . "\" onload=\"javascript:ResizeImage(this,120,120);\" alt=\"" . $data['goods_name'] . "\"></a></div>
  139. <div class=\"goodsinfo\">
  140. <dl>
  141. <dt><i class=\"desc-type desc-type-xianshi\">" . lang('store_sns_xianshi') . "</i><a target=\"_blank\" href=\"" . (string)url('home/Goods/index', array('goods_id'=>$data['goods_id'])) . "\">" . $data['goods_name'] . "</a></dt>
  142. <dd>" . lang('sns_sharegoods_price') . lang('ds_colon') . lang('currency') . ds_price_format($data['goods_price']) . "</dd>
  143. <dd>" . lang('store_sns_formerprice') . lang('ds_colon') . lang('currency') . ds_price_format($data['xianshigoods_price']) . "</dd>
  144. <dd dstype=\"collectbtn_" . $data['goods_id'] . "\"><a href=\"javascript:void(0);\" onclick=\"javascript:collect_goods('" . $data['goods_id'] . "','succ','collectbtn_" . $data['goods_id'] . "');\">" . lang('sns_sharegoods_collect') . "</a></dd>
  145. </dl>
  146. </div>
  147. </div>";
  148. break;
  149. case '6':
  150. $rs = "<div class=\"fd-media\">
  151. <div class=\"goodsimg\"><a target=\"_blank\" href=\"" . (string)url('Store/index', array('store_id'=>$data['store_id'])) . "\"><img src=\"" . HOME_SITE_ROOT . "/images/mjs-pic.gif\" onload=\"javascript:ResizeImage(this,120,120);\" alt=\"".$data['mansong_name']."\"></a></div>
  152. <div class=\"goodsinfo\">
  153. <dl>
  154. <dt><i class=\"desc-type desc-type-mansong\">" . lang('store_sns_mansong') . "</i><a target=\"_blank\" href=\"" . (string)url('Store/index', array('store_id'=>$data['store_id'])) . "\">" . $data['mansong_name'] . "</a></dt>
  155. <dd>" . lang('store_sns_start-stop_time') . lang('ds_colon') . date('Y-m-d H:i', $data['mansong_starttime']) . "~" . date('Y-m-d H:i', $data['mansong_endtime']) . "</dd>
  156. </dl>
  157. </div>
  158. </div>";
  159. break;
  160. case '7':
  161. $rs = "<div class=\"fd-media\">
  162. <div class=\"goodsimg\"><a target=\"_blank\" href=\"" . (string)url('home/Goods/index', array('goods_id'=>$data['goods_id'])) . "\"><img src=\"" . goods_cthumb($data['bl_img'], 240, $data['store_id']) . "\" onload=\"javascript:ResizeImage(this,120,120);\" alt=\"" . $data['bl_name'] . "\"></a></div>
  163. <div class=\"goodsinfo\">
  164. <dl>
  165. <dt><i class=\"desc-type desc-type-bundling\">" . lang('store_sns_bundling') . "</i><a target=\"_blank\" href=\"" . (string)url('home/Goods/index', array('goods_id'=>$data['goods_id'])) . "\">".$data['bl_name']."</a></dt>
  166. <dd>" . lang('store_sns_bundling_price') . lang('ds_colon') . lang('currency') . ds_price_format($data['bl_discount_price']) . "</dd>
  167. <dd>" . (($data['bl_freight_choose']==1) ? lang('store_sns_free_shipping') : lang('sns_sharegoods_freight') . lang('ds_colon') . lang('currency') . ds_price_format($data['bl_freight'])) . "</dd>
  168. </dl>
  169. </div>
  170. </div>";
  171. break;
  172. case '8':
  173. $rs = "<div class=\"fd-media\">
  174. <div class=\"goodsimg\"><a target=\"_blank\" href=\"" . (string)url('home/Goods/index', array('goods_id'=>$data['goods_id'])) . "\"><img src=\"" . groupbuy_thumb($data['group_pic'],'small',$data['store_id']) . "\" onload=\"javascript:ResizeImage(this,120,120);\" alt=\"" . $data['group_name'] . "\"></a></div>
  175. <div class=\"goodsinfo\">
  176. <dl>
  177. <dt><i class=\"desc-type desc-type-groupbuy\">" . lang('store_sns_groupbuy') . "</i><a target=\"_blank\" href=\"" . (string)url('home/Goods/index', array('goods_id'=>$data['goods_id'])) . "\">" . $data['group_name'] . "</a></dt>
  178. <dd>" . lang('store_sns_goodsprice') . lang('ds_colon') . lang('currency') . ds_price_format($data['goods_price']) . "</dd>
  179. <dd>" . lang('store_sns_groupprice') . lang('ds_colon') . lang('currency') . ds_price_format($data['groupbuy_price']) . "</dd>
  180. <dd>" . lang('store_sns_start-stop_time') . lang('ds_colon') . date('Y-m-d H:i', $data['start_time']) . "~" . date('Y-m-d H:i', $data['end_time']) . "</dd>
  181. </dl>
  182. </div>
  183. </div>";
  184. break;
  185. case '9':
  186. $rs = "<div class=\"fd-media\">
  187. <div class=\"goodsimg\"><a target=\"_blank\" href=\"" . (string)url('home/Goods/index', array('goods_id'=>$data['goods_id'])) . "\"><img src=\"" . goods_thumb($data, 240) . "\" onload=\"javascript:ResizeImage(this,120,120);\" alt=\"" . $data['goods_name'] . "\"></a></div>
  188. <div class=\"goodsinfo\">
  189. <dl>
  190. <dt><i class=\"desc-type desc-type-recommend\">" . lang('store_sns_store_recommend') . "</i><a target=\"_blank\" href=\"" . (string)url('home/Goods/index', array('goods_id'=>$data['goods_id'])) . "\">" . $data['goods_name'] . "</a></dt>
  191. <dd>" . lang('sns_sharegoods_price') . lang('ds_colon') . lang('currency') . ds_price_format($data['goods_price']) . "</dd>
  192. <dd>" . lang('sns_sharegoods_freight') . lang('ds_colon') . lang('currency') . ds_price_format($data['goods_freight']) . "</dd>
  193. <dd dstype=\"collectbtn_" . $data['goods_id'] . "\"><a href=\"javascript:void(0);\" onclick=\"javascript:collect_goods('" . $data['goods_id'] . "','succ','collectbtn_" . $data['goods_id'] . "');\">" . lang('sns_sharegoods_collect') . "</a></dd>
  194. </dl>
  195. </div>
  196. </div>";
  197. break;
  198. case '10':
  199. $rs = "<div class=\"fd-media\">
  200. <div class=\"goodsimg\"><a target=\"_blank\" href=\"" . (string)url('home/Goods/index', array('goods_id'=>$data['goods_id'])) . "\"><img src=\"" . goods_thumb($data, 240) . "\" onload=\"javascript:ResizeImage(this,120,120);\" alt=\"" . $data['goods_name'] . "\"></a></div>
  201. <div class=\"goodsinfo\">
  202. <dl>
  203. <dt><i class=\"desc-type desc-type-hotsell\">" . lang('store_sns_hotsell') . "</i><a target=\"_blank\" href=\"" . (string)url('home/Goods/index', array('goods_id'=>$data['goods_id'])) . "\">" . $data['goods_name'] . "</a></dt>
  204. <dd>" . lang('sns_sharegoods_price') . lang('ds_colon') . lang('currency') . ds_price_format($data['goods_price']) . "</dd>
  205. <dd>" . lang('sns_sharegoods_freight') . lang('ds_colon') . lang('currency') . ds_price_format($data['goods_freight']) . "</dd>
  206. <dd dstype=\"collectbtn_" . $data['goods_id'] . "\"><a href=\"javascript:void(0);\" onclick=\"javascript:collect_goods('" . $data['goods_id'] . "','succ','collectbtn_" . $data['goods_id']. "');\">" . lang('sns_sharegoods_collect') . "</a></dd>
  207. </dl>
  208. </div>
  209. </div>";
  210. break;
  211. }
  212. return $rs;
  213. }
  214. }