Channelptbzf.php 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <?php
  2. namespace app\admin\controller;
  3. use app\common\library\OneFileUpload;
  4. use app\common\logic\Member as MemberService;
  5. use think\Loader;
  6. use think\Db;
  7. class Channelptbzf extends Admin
  8. {
  9. protected $gameList;
  10. public function _initialize()
  11. {
  12. parent::_initialize(); // TODO: Change the autogenerated stub
  13. }
  14. /**
  15. *玩家福利列表
  16. */
  17. public function index()
  18. {
  19. $where = [];
  20. $order = 'create_time desc';
  21. $list = Db::table('mw_channel_ptb')->alias('info')
  22. ->join('nw_channel_admin channel', 'channel.id = info.channel_id')
  23. ->field(['channel.username as dep_name','info.id','info.je','info.status','info.out_trade_no','info.create_time'])
  24. ->where($where)
  25. ->order($order)
  26. ->paginate();
  27. $this->assign('list', $list);
  28. $this->assign('page', $list->render());
  29. return $this->fetch();
  30. }
  31. public function edit()
  32. {
  33. $id = $this->request->param('id', '', 'intval');
  34. $appModel = Db::name('mw_channel_ptb');
  35. if (!$data = $appModel->find($id)) {
  36. $this->error('参数错误,不存在该数据');
  37. }
  38. if (empty($id)) {
  39. $this->error('参数错误!');
  40. }
  41. if ($this->request->isPost()) {
  42. $data = $this->request->post();
  43. $aaa = Db::name('mw_channel_ptb')->where(['id'=>$id])->find();
  44. Db::name('mw_channel_ptb')->where(['id'=>$id])->update($data);
  45. $channel_id = $aaa['channel_id'];
  46. $pyb = Db::name('nw_channel_admin')->where(['id'=>$channel_id])->find();
  47. $data_info['pyb'] = $pyb['pyb'] + $aaa['je'];
  48. Db::name('nw_channel_admin')->where(['id'=>$channel_id])->update($data_info);
  49. $this->success('修改成功',url('index'));
  50. }
  51. $this->assign('data', $data);
  52. return $this->fetch();
  53. }
  54. }