Goods.php 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. <?php
  2. namespace app\shop\controller;
  3. use app\common\controller\Frontend;
  4. use GuzzleHttp\json_decode;
  5. use think\cache\driver\Redis;
  6. class Goods extends Frontend
  7. {
  8. protected $noNeedLogin = [''];
  9. protected $noNeedRight = '*';
  10. protected $layout = '';
  11. public function _initialize()
  12. {
  13. parent::_initialize();
  14. }
  15. function goodslist()
  16. {
  17. $catid=input('catid');
  18. $login_studio=$this->auth->login_studio;
  19. $studio=db('studio')->where(['title'=>$login_studio])->find();
  20. if(time()>=strtotime(date("Y-m-d {$studio['start']}")) && time()<= strtotime(date("Y-m-d {$studio['end']}")) )
  21. {
  22. $status='营业中';
  23. }elseif(time()< strtotime(date("Y-m-d {$studio['start']}"))){
  24. $status='停业中';
  25. }elseif(time() > strtotime(date("Y-m-d {$studio['end']}"))){
  26. $status='停业中';
  27. }
  28. $isappoint=db('studio_user')->where(['sid'=>$studio['id'],'userid'=>$this->auth->id])->find();
  29. if($isappoint)
  30. {
  31. $flag=0;
  32. }else{
  33. $flag=1;
  34. }
  35. $this->view->assign([
  36. 'title'=>get_table_column('goods_cats',$catid,'name'),
  37. 'catid'=>$catid,
  38. 'studio'=>$studio,
  39. 'status'=>$status,
  40. 'flag'=>$flag,
  41. ]);
  42. return $this->fetch();
  43. }
  44. /* 商品详情 */
  45. function goodsdetailed()
  46. {
  47. $id=input('id');
  48. $info=db('goods')->where(['id'=>$id])->find();
  49. if(!empty($info['images']))
  50. {
  51. $images=$info['image'].','.$info['images'];
  52. $info['img']=explode(',', $images);
  53. }else{
  54. $info['img']=[$info['image']];
  55. }
  56. $this->view->assign([
  57. "info"=>$info,
  58. ]);
  59. return $this->fetch();
  60. }
  61. /* 商品详情 */
  62. function goodsdetailed1()
  63. {
  64. $id=input('id');
  65. $info=db('goods')->where(['id'=>$id])->find();
  66. if(!empty($info['images']))
  67. {
  68. $images=$info['image'].','.$info['images'];
  69. $info['img']=explode(',', $images);
  70. }else{
  71. $info['img']=[$info['image']];
  72. }
  73. $this->view->assign([
  74. "info"=>$info,
  75. ]);
  76. return $this->fetch();
  77. }
  78. /* 评论 */
  79. function appraise()
  80. {
  81. $goodsid=input('goodsid');
  82. $this->view->assign('goodsid',$goodsid);
  83. return $this->fetch();
  84. }
  85. /* 购物车 */
  86. function cart()
  87. {
  88. return $this->fetch();
  89. }
  90. }