Index.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <?php
  2. namespace app\api\controller\company;
  3. use app\common\controller\Apic;
  4. use think\Db;
  5. /**
  6. * 会员接口
  7. */
  8. class Index extends Apic
  9. {
  10. protected $noNeedLogin = [];
  11. protected $noNeedRight = '*';
  12. public function _initialize()
  13. {
  14. parent::_initialize();
  15. }
  16. //首页
  17. public function index(){
  18. }
  19. //首页轮播
  20. public function banner(){
  21. $where = [
  22. 'company_id' => $this->auth->company_id,
  23. 'status' => 1,
  24. 'posisiton' => 0
  25. ];
  26. $list = Db::name('banner')->where($where)->order('weigh desc,id desc')->autopage()->select();
  27. $this->success(1,$list);
  28. }
  29. //商家钱包明细
  30. public function money_log(){
  31. $type = input('type',0);
  32. $map = [
  33. 'user_id' => $this->auth->id,
  34. ];
  35. if($type){
  36. $map['log_type'] = $type;
  37. }
  38. $list = Db::name('company_money_log')
  39. ->field('id,log_type,change_value,remain,remark,createtime')
  40. ->where($map)->order('id desc')->autopage()->select();
  41. $list = $this->list_appen_logtext($list);
  42. $this->success(1,$list);
  43. }
  44. //追加log_text
  45. private function list_appen_logtext($list){
  46. if(!empty($list)){
  47. $conf = config('wallet.logtype');
  48. foreach($list as $key => $val){
  49. $list[$key]['log_text'] = isset($conf[$val['log_type']]) ? $conf[$val['log_type']] : '';
  50. }
  51. }
  52. return $list;
  53. }
  54. }