GoodsStockLog.php 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | ThinkAdmin
  4. // +----------------------------------------------------------------------
  5. // | 版权所有 2014~2019 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
  6. // +----------------------------------------------------------------------
  7. // | 官方网站: http://demo.thinkadmin.top
  8. // +----------------------------------------------------------------------
  9. // | 开源协议 ( https://mit-license.org )
  10. // +----------------------------------------------------------------------
  11. // | gitee 代码仓库:https://gitee.com/zoujingli/ThinkAdmin
  12. // | github 代码仓库:https://github.com/zoujingli/ThinkAdmin
  13. // +----------------------------------------------------------------------
  14. namespace app\approve\controller;
  15. use app\common\constant\CommonConstant;
  16. use app\common\model\GoodsStockLog as model;
  17. use library\Controller;
  18. /**
  19. * 商品入库记录
  20. */
  21. class GoodsStockLog extends Controller
  22. {
  23. /**
  24. * 绑定数据表
  25. * @var string
  26. */
  27. protected $table = 'GoodsStockLog';
  28. /**
  29. * 控制器初始化
  30. */
  31. protected function initialize()
  32. {
  33. $this->get_goods_stock_log_list = CommonConstant::get_goods_stock_log_list();
  34. }
  35. /**
  36. * 列表
  37. * @auth true
  38. * @menu true
  39. * @throws \think\Exception
  40. * @throws \think\db\exception\DataNotFoundException
  41. * @throws \think\db\exception\ModelNotFoundException
  42. * @throws \think\exception\DbException
  43. */
  44. public function index()
  45. {
  46. $this->type = $type = input('type') ?: 0;
  47. $this->goods_id = $goods_id = input('goods_id') ?: 0;
  48. $this->title = '商品入库出库记录';
  49. $data = model::when($type > 0, function ($query) use ($type) {
  50. $query->where('type', $type);
  51. })
  52. ->where('goods_id', $goods_id)
  53. ->order('id desc');
  54. self::_init($data);
  55. }
  56. }