Storesnstracelog.php 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  1. <?php
  2. namespace app\common\model;
  3. use think\facade\Db;
  4. /**
  5. * ============================================================================
  6. * DSMall多用户商城
  7. * ============================================================================
  8. * 版权所有 2014-2028 长沙德尚网络科技有限公司,并保留所有权利。
  9. * 网站地址: http://www.csdeshang.com
  10. * ----------------------------------------------------------------------------
  11. * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和使用 .
  12. * 不允许对程序代码以任何形式任何目的的再发布。
  13. * ============================================================================
  14. * 数据层模型
  15. */
  16. class Storesnstracelog extends BaseModel
  17. {
  18. public $page_info;
  19. /**
  20. * 店铺动态列表
  21. * @access public
  22. * @author csdeshang
  23. * @param array $condition 条件
  24. * @param string $field 字段
  25. * @param string $order 排序
  26. * @param int $limit 限制
  27. * @param int $pagesize 分页
  28. * @return array
  29. */
  30. public function getStoresnstracelogList($condition, $field = '*', $order = 'stracelog_id desc',$limit = 0, $pagesize = 0) {
  31. if($pagesize) {
  32. $res = Db::name('storesnstracelog')->where($condition)->field($field)->order($order)->paginate(['list_rows'=>$pagesize,'query' => request()->param()],false);
  33. $this->page_info=$res;
  34. return $res->items();
  35. }else{
  36. return Db::name('storesnstracelog')->where($condition)->field($field)->order($order)->limit($limit)->select()->toArray();
  37. }
  38. }
  39. /**
  40. * 获得店铺动态总数
  41. * @access public
  42. * @author csdeshang
  43. * @param array $condition 条件
  44. * @return int
  45. */
  46. public function getStoresnstracelogCount($condition) {
  47. return Db::name('storesnstracelog')->where($condition)->count();
  48. }
  49. /**
  50. * 获取单条店铺动态
  51. * @access public
  52. * @author csdeshang
  53. * @param array $condition 条件
  54. * @return array
  55. */
  56. public function getStoresnstracelogInfo($condition) {
  57. return Db::name('storesnstracelog')->where($condition)->find();
  58. }
  59. /**
  60. * 保存店铺动态
  61. * @access public
  62. * @author csdeshang
  63. * @param array $data 数据
  64. * @return boolean
  65. */
  66. public function addStoresnstracelog($data) {
  67. return Db::name('storesnstracelog')->insertGetId($data);
  68. }
  69. /**
  70. * 保存店铺动态
  71. * @access public
  72. * @author csdeshang
  73. * @param array $data 数据
  74. * @return boolean
  75. */
  76. public function addStoresnstracelogAll($data) {
  77. return Db::name('storesnstracelog')->insertAll($data);
  78. }
  79. /**
  80. * 更新店铺动态
  81. * @access public
  82. * @author csdeshang
  83. * @param array $update 更新数据
  84. * @param array $condition 条件
  85. * @return boolean
  86. */
  87. public function editStoresnstracelog($update, $condition) {
  88. return Db::name('storesnstracelog')->where($condition)->update($update);
  89. }
  90. /**
  91. * 删除店铺动态
  92. * @access public
  93. * @author csdeshang
  94. * @param array $condition 条件
  95. * @return boolean
  96. */
  97. public function delStoresnstracelog($condition) {
  98. return Db::name('storesnstracelog')->where($condition)->delete();
  99. }
  100. /**
  101. * 拼写个类型样式
  102. * @param type $type 动态类型
  103. * @param type $data 相关数据
  104. * @return string
  105. */
  106. public function spellingStyle($type,$data){
  107. //1'relay',2'normal',3'new',4'coupon',5'xianshi',6'mansong',7'bundling',8'groupbuy',9'recommend',10'hotsell'
  108. $rs = '';
  109. switch ($type){
  110. case '2':
  111. break;
  112. case '3':
  113. $rs = "<div class=\"fd-media\">
  114. <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>
  115. <div class=\"goodsinfo\">
  116. <dl>
  117. <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>
  118. <dd>" . lang('sns_sharegoods_price') . lang('ds_colon') . lang('currency') . ds_price_format($data['goods_price']) . "</dd>
  119. <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>
  120. <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>
  121. </dl>
  122. </div>
  123. </div>";
  124. break;
  125. case '4':
  126. $rs = "<div class=\"fd-media\">
  127. <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>
  128. <div class=\"goodsinfo\">
  129. <dl>
  130. <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>
  131. <dd>" . lang('store_sns_coupon_price') . lang('ds_colon') . lang('currency') . ds_price_format($data['coupon_price']) . "</dd>
  132. <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>
  133. </dl>
  134. </div>
  135. </div>";
  136. break;
  137. case '5':
  138. $rs = "<div class=\"fd-media\">
  139. <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>
  140. <div class=\"goodsinfo\">
  141. <dl>
  142. <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>
  143. <dd>" . lang('sns_sharegoods_price') . lang('ds_colon') . lang('currency') . ds_price_format($data['goods_price']) . "</dd>
  144. <dd>" . lang('store_sns_formerprice') . lang('ds_colon') . lang('currency') . ds_price_format($data['xianshigoods_price']) . "</dd>
  145. <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>
  146. </dl>
  147. </div>
  148. </div>";
  149. break;
  150. case '6':
  151. $rs = "<div class=\"fd-media\">
  152. <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>
  153. <div class=\"goodsinfo\">
  154. <dl>
  155. <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>
  156. <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>
  157. </dl>
  158. </div>
  159. </div>";
  160. break;
  161. case '7':
  162. $rs = "<div class=\"fd-media\">
  163. <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>
  164. <div class=\"goodsinfo\">
  165. <dl>
  166. <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>
  167. <dd>" . lang('store_sns_bundling_price') . lang('ds_colon') . lang('currency') . ds_price_format($data['bl_discount_price']) . "</dd>
  168. <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>
  169. </dl>
  170. </div>
  171. </div>";
  172. break;
  173. case '8':
  174. $rs = "<div class=\"fd-media\">
  175. <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>
  176. <div class=\"goodsinfo\">
  177. <dl>
  178. <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>
  179. <dd>" . lang('store_sns_goodsprice') . lang('ds_colon') . lang('currency') . ds_price_format($data['goods_price']) . "</dd>
  180. <dd>" . lang('store_sns_groupprice') . lang('ds_colon') . lang('currency') . ds_price_format($data['groupbuy_price']) . "</dd>
  181. <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>
  182. </dl>
  183. </div>
  184. </div>";
  185. break;
  186. case '9':
  187. $rs = "<div class=\"fd-media\">
  188. <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>
  189. <div class=\"goodsinfo\">
  190. <dl>
  191. <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>
  192. <dd>" . lang('sns_sharegoods_price') . lang('ds_colon') . lang('currency') . ds_price_format($data['goods_price']) . "</dd>
  193. <dd>" . lang('sns_sharegoods_freight') . lang('ds_colon') . lang('currency') . ds_price_format($data['goods_freight']) . "</dd>
  194. <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>
  195. </dl>
  196. </div>
  197. </div>";
  198. break;
  199. case '10':
  200. $rs = "<div class=\"fd-media\">
  201. <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>
  202. <div class=\"goodsinfo\">
  203. <dl>
  204. <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>
  205. <dd>" . lang('sns_sharegoods_price') . lang('ds_colon') . lang('currency') . ds_price_format($data['goods_price']) . "</dd>
  206. <dd>" . lang('sns_sharegoods_freight') . lang('ds_colon') . lang('currency') . ds_price_format($data['goods_freight']) . "</dd>
  207. <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>
  208. </dl>
  209. </div>
  210. </div>";
  211. break;
  212. }
  213. return $rs;
  214. }
  215. }