Sellergoodsadd.php 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. <?php
  2. namespace app\api\controller;
  3. /**
  4. *
  5. *
  6. * ----------------------------------------------------------------------------
  7. *
  8. * 卖家商品控制器
  9. */
  10. class Sellergoodsadd extends MobileSeller
  11. {
  12. public function initialize()
  13. {
  14. parent::initialize(); // TODO: Change the autogenerated stub
  15. $this->obj = new Sellergoods($this->app);
  16. }
  17. /**
  18. * 三方店铺验证,商品数量,有效期
  19. */
  20. private function checkStore()
  21. {
  22. $goodsLimit = (int) $this->store_grade['storegrade_goods_limit'];
  23. if ($goodsLimit > 0) {
  24. // 是否到达商品数上限
  25. $goods_num = model('goods')->getGoodsCommonCount(array('store_id' => session('store_id')));
  26. if ($goods_num >= $goodsLimit) {
  27. ds_json_encode(10001, lang('store_goods_index_goods_limit') . $goodsLimit . lang('store_goods_index_goods_limit1'));
  28. }
  29. }
  30. }
  31. public function goods_class()
  32. {
  33. $this->obj->goods_class();
  34. }
  35. public function get_common_data()
  36. {
  37. $this->obj->get_common_data();
  38. }
  39. public function save_goods()
  40. {
  41. $this->checkStore();
  42. $this->obj->save_goods();
  43. }
  44. public function image_upload()
  45. {
  46. $this->obj->image_upload();
  47. }
  48. public function video_upload()
  49. {
  50. $this->obj->video_upload();
  51. }
  52. public function add_spec()
  53. {
  54. $this->obj->add_spec();
  55. }
  56. public function edit_image()
  57. {
  58. $this->obj->edit_image();
  59. }
  60. public function save_image()
  61. {
  62. $this->obj->save_image();
  63. }
  64. }