123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172 |
- <?php
- /**
- *
- * User: anyluck
- * Date: 2020/6/2
- * Time: 17:43
- */
- namespace app\admin\controller;
- use app\common\controller\Orde;
- use app\common\model\Bond;
- use app\common\model\GeneralFinance;
- use think\facade\Request;
- use think\facade\View;
- class Finance
- {
- // 财务管理
- /**
- * 财务统计
- */
- public function tongji()
- {
- if (Request::isPost()) {
- $name = input("name");
- $page = input("page") ?: 1;
- $limit = input("limit") ?: 10;
- $where = [];
- // if ($name){
- // $where["name"]=["like","% $name %"];
- // }
- $where["daili"]=0;
- $list = \app\common\model\Finance::where($where)->order("id desc")->paginate(["list_row" => $limit, "page" => $page])->each(function ($item) {
- $user = \app\common\model\User::where(["id" => $item["user_id"]])->field("name")->find();
- $item["user_name"] = $user->name;
- return $item;
- })->toArray();
- return $result = ['code' => 0, 'msg' => lang('get info success'), 'data' => $list['data'] ?: [], 'count' => $list['total'] ?: 0];
- }
- return View::fetch();
- }
- /**
- * 充值审核
- */
- public function shenhe()
- {
- if (Request::isPost()) {
- $name = input("name");
- $page = input("page") ?: 1;
- $limit = input("limit") ?: 10;
- $where = [];
- // if ($name){
- // $where["name"]=["like","% $name %"];
- // }
- // $where["type"]=0;
- $list = GeneralFinance::where($where)->order("status asc,id desc")->paginate(["list_row" => $limit, "page" => $page])->each(function ($item) {
- $user = \app\common\model\User::where(["id" => $item["user_id"]])->field("name")->find();
- $item["user_name"] = $user->name;
- $item["add_time"]=date("Y-m-d H:i:s",$item["add_time"]);
- if ($item["status"]==0){
- $item["status"]="审核中";
- }elseif($item["status"]==1){
- $item["status"]="已通过";
- }else{
- $item["status"]="已拒绝";
- }
- return $item;
- })->toArray();
- return $result = ['code' => 0, 'msg' => lang('get info success'), 'data' => $list['data'] ?: [], 'count' => $list['total'] ?: 0];
- }
- return View::fetch();
- }
- // 审核拒绝general_finance
- public function jujue()
- {
- $id=input("id");
- GeneralFinance::update(["status"=>2],["id"=>$id]);
- json_result(200,"设置成功");
- }
- // 充值成功
- public function czcg()
- {
- $id=input("id");
- $bond=GeneralFinance::where(["id"=>$id])->find();
- // 给用户加钱
- $user=\app\common\model\User::where(["id"=>$bond->user_id])->find();
- $money=$user->money+$bond->actual_money;
- \app\common\model\User::update(["money"=>$money],["id"=>$bond->user_id]);
- GeneralFinance::update(["status"=>1],["id"=>$id]);
- // 添加财务日记
- Orde::Finance($bond->user_id,"您的充值申请审核通过",$bond->actual_money,0);
- json_result(200,"设置成功");
- }
- /**
- * 代理收入
- */
- public function daili()
- {
- if (Request::isPost()) {
- $name = input("name");
- $page = input("page") ?: 1;
- $limit = input("limit") ?: 10;
- $where = [];
- // if ($name){
- // $where["name"]=["like","% $name %"];
- // }
- $where["daili"]=1;
- $list = \app\common\model\Finance::where($where)->order("id desc")->paginate(["list_row" => $limit, "page" => $page])->each(function ($item) {
- $user = \app\common\model\User::where(["id" => $item["user_id"]])->field("name")->find();
- $item["user_name"] = $user->name;
- return $item;
- })->toArray();
- return $result = ['code' => 0, 'msg' => lang('get info success'), 'data' => $list['data'] ?: [], 'count' => $list['total'] ?: 0];
- }
- return View::fetch();
- }
- /**
- * 赠送记录
- */
- public function zhengshon()
- {
- if (Request::isPost()) {
- $name = input("name");
- $page = input("page") ?: 1;
- $limit = input("limit") ?: 10;
- $where = [];
- // if ($name){
- // $where["name"]=["like","% $name %"];
- // }
- $where["daili"]=2;
- $list = \app\common\model\Finance::where($where)->order("id desc")->paginate(["list_row" => $limit, "page" => $page])->each(function ($item) {
- $user = \app\common\model\User::where(["id" => $item["user_id"]])->field("name")->find();
- $item["user_name"] = $user->name;
- return $item;
- })->toArray();
- return $result = ['code' => 0, 'msg' => lang('get info success'), 'data' => $list['data'] ?: [], 'count' => $list['total'] ?: 0];
- }
- return View::fetch();
- }
- }
|