GiftLog.php 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  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\user\controller;
  15. use library\Controller;
  16. use think\Db;
  17. use function GuzzleHttp\Psr7\build_query;
  18. /**
  19. * 转赠记录管理
  20. * Class Gift
  21. * @package app\user\controller
  22. */
  23. class GiftLog extends Controller
  24. {
  25. /**
  26. * 绑定数据表
  27. * @var string
  28. */
  29. protected $table = 'GoodsCollect';
  30. /**
  31. * 作品列表
  32. * @auth true
  33. * @menu true
  34. * @throws \think\Exception
  35. * @throws \think\db\exception\DataNotFoundException
  36. * @throws \think\db\exception\ModelNotFoundException
  37. * @throws \think\exception\DbException
  38. * @throws \think\exception\PDOException
  39. */
  40. public function index()
  41. {
  42. $this->title = '溯源';
  43. $id = input('id');
  44. $original_id = input('original_id');
  45. if($original_id > 0){
  46. $list = Db::table('goods_collect')
  47. ->alias('i')
  48. ->field('i.*,m.name as user_name,m.headimg,m.phone')
  49. ->join('store_member m','m.id = i.user_id','LEFT')
  50. ->where('original_id|i.id',$original_id)
  51. ->order('i.id asc')->select();
  52. }else{
  53. $list = Db::table('goods_collect')
  54. ->alias('i')
  55. ->field('i.*,m.name as user_name,m.headimg,m.phone')
  56. ->join('store_member m','m.id = i.user_id','LEFT')
  57. ->where('i.id',$id)
  58. ->order('i.id asc')->select();
  59. }
  60. $this->assign('list',$list);
  61. $this->fetch('index');
  62. }
  63. /**
  64. * 数据列表处理
  65. * @auth true
  66. * @menu true
  67. * @param array $data
  68. * @throws \think\db\exception\DataNotFoundException
  69. * @throws \think\db\exception\ModelNotFoundException
  70. * @throws \think\exception\DbException
  71. */
  72. protected function _index_page_filter(&$data)
  73. {
  74. }
  75. //删除货主
  76. public function remove()
  77. {
  78. $this->_save($this->table, ['status' => '3']);
  79. }
  80. public function edit(){
  81. $this->title = '编辑';
  82. $this->_form($this->table, 'form');
  83. }
  84. protected function _form_filter(&$data)
  85. {
  86. }
  87. }