123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702 |
- <?php
- namespace app\admin\controller\project;
- use app\admin\BaseController;
- use app\admin\controller\field\Field;
- use app\admin\model\CostProject as CostProjectModel;
- use app\admin\model\ProjectAudit;
- use app\admin\model\ProjectFile;
- use think\App;
- use app\admin\model\Appropriation as AppropriationModel;
- use think\db\exception\DbException;
- use think\facade\Db;
- use think\facade\View;
- class Appropriation extends BaseController
- {
- public function __construct(App $app)
- {
- parent::__construct($app);
- $this->Field = new Field($this->app);
- $this->Costmodel = new CostProjectModel();
- $this->filemodel = new ProjectFile();
- $this->model = new AppropriationModel();
- $this->uid = get_login_admin("id");
- $this->nickname = get_login_admin("nickname");
- }
- public function datalist()
- {
- if (request()->isAjax()) {
- $param = get_params();
- $where = [];
- if(!empty($param["keywords"])){
- $where[] = ["review_unit_name","like","%".$param["keywords"]."%"];
- }
- $rows = empty($param['limit']) ? get_config('app . page_size') : $param['limit'];
- $order = empty($param['order']) ? 'id desc' : $param['order'];
- $list = $this->model->where("entrust_unit", get_login_admin("unit_name"))
- ->where("status",">",0)
- ->where($where)
- ->order($order)->paginate($rows, false, ['query' => $param])
- ->each(function ($item) {
- $data = Db::name("appropriation_project")->alias("a")->join("cost_project c","a.project_id=c.id","left")
- ->where("a.uid","not null")->where("a.uid",$item->id)
- ->where("c.entrust_unit",get_login_admin("unit_name"))->column("c.project_name,c.sent_review_cost");
- if (!empty($data)) {
- $a = 0;
- $project_name = '';
- $appropriation_amount = 0;
- foreach ($data as $key => $value) {
- $a += 1;
- $project_name .= $a . "." . $value["project_name"] . ",";
- $appropriation_amount += $value["sent_review_cost"];
- }
- $item->a = count($data);
- $item->appropriation_amount = $appropriation_amount;
- $item->project_names = $project_name;
- }
- });
- return table_assign(0, '', $list);
- } else{
- // $field = $this->Field->get_field_rules_new($this->uid);
- // $see_auth = isset($field["see_auth"]) ? $field["see_auth"] : 3;
- $where[] = ["delete_time", "=", 0];
- $where[] = ["entrust_unit", "=", get_login_admin('unit_name')];
- $where[] = ["project_status", ">", 2];
- $where[] = ["project_status", "<>", 9];
- // $where2[] = ["delete_time", "=", 0];
- // $where2[] = ["entrust_unit", "=", get_login_admin('unit_name')];
- // $where2[] = ["project_status", ">", 2];
- // $where2[] = ["project_status", "<>", 8];
- // if ($see_auth == 3) {
- // $where[] = ["entrust_maker", "=", $this->uid];
- // $where2[] = ["entrust_approver", "=", $this->uid];
- // } elseif ($see_auth == 0) {
- // $where[] = ["entrust_maker", "=", $this->uid];
- // $where2[] = ["entrust_approver", "=", $this->uid];
- //
- // }
- $list = $this->Costmodel->where($where)->column("sent_review_cost");
- $data = Db::name("appropriation")->alias("a")->leftJoin("appropriation_project p","a.id=p.uid")->leftJoin("cost_project c","p.project_id=c.id")
- ->where("p.uid","not null")
- ->where("a.status","2")
- ->where("c.entrust_unit",get_login_admin("unit_name"))->column("c.id");
- $appropriation = $this->model->where([["entrust_unit","=", get_login_admin("unit_name")],["status","=",2]])->paginate(10000, false, ['query' => []]);
- $sent_review_cost = 0.00;
- $invoicing_amount = 0.00;
- $appropriation_amount = 0.00;
- foreach ($list as $item=>$value){
- //送审服务费
- $sent_review_cost += (float)sprintf("%01.2f", $value);
- $sent_review_cost = number_format($sent_review_cost, 2, '.', '');
- }
- foreach ($appropriation as $item=>$value){
- if($value["invoice_status"]==1){
- //开票金额
- $invoicing_amount += (float)$value["invoicing_amount"];
- $invoicing_amount = number_format($invoicing_amount, 2, '.', '');
- }
- }
- $invoicing_amount = number_format($invoicing_amount, 2, '.', '');
- $list_ids = $this->Costmodel->where($where)->column("id,sent_review_cost");
- foreach ($list_ids as $item=>$value){
- //已请款
- if(in_array($value["id"],$data)){
- $appropriation_amount += (float)$value["sent_review_cost"];
- $appropriation_amount = number_format($appropriation_amount, 2, '.', '');
- }
- }
- $appropriation_amount = number_format($appropriation_amount, 2, '.', '');
- //未请款
- $not_appropriation_amount = number_format($sent_review_cost-$appropriation_amount,2,'.','');
- //未开票
- $not_invoicing_amount = number_format($sent_review_cost-$invoicing_amount,2,'.','');
- View::assign("sent_review_cost",$sent_review_cost);
- View::assign("appropriation_amount",$appropriation_amount);
- View::assign("not_appropriation_amount",$not_appropriation_amount);
- View::assign("invoicing_amount",$invoicing_amount);
- View::assign("not_invoicing_amount",$not_invoicing_amount);
- return view();
- }
- }
- public function datalist_company()
- {
- if (request()->isAjax()) {
- $param = get_params();
- $rows = empty($param['limit']) ? get_config('app . page_size') : $param['limit'];
- $order = empty($param['order']) ? 'id desc' : $param['order'];
- $where = [];
- if(!empty($param["keywords"])){
- $where[] = ["entrust_unit_name","like","%".$param["keywords"]."%"];
- }
- $list = $this->model->where("review_unit", get_login_admin("unit_name"))
- ->where($where)
- ->order($order)->paginate($rows, false, ['query' => $param])
- ->each(function ($item) {
- $item->invoice_detail = Db::name("ProjectFile")->alias("p")->where([["p.topic_id","=",$item->id],["p.module","=","appropriation"]])
- ->join("file f","p.file_id=f.id")->value("name");
- $data = Db::name("appropriation_project")->alias("a")->join("cost_project c","a.project_id=c.id","left")
- ->where("a.uid","not null")->where("a.uid",$item->id)
- ->where("c.review_unit",get_login_admin("unit_name"))->column("c.project_name,c.sent_review_cost");
- if (!empty($data)) {
- $a = 0;
- $project_name = '';
- $appropriation_amount = 0;
- foreach ($data as $key => $value) {
- $a += 1;
- $project_name .= $a . "." . $value["project_name"] . ",";
- $appropriation_amount += $value["sent_review_cost"];
- }
- $item->a = count($data);
- $item->appropriation_amount = $appropriation_amount;
- $item->project_names = $project_name;
- }
- });
- return table_assign(0, '', $list);
- } else {
- $inarr = array();
- $review_unit = $this->Costmodel->where("review_unit", get_login_admin("unit_name"))->field('id,review_head,operate_head,operate_team')->select()->toArray();
- for ($i = 0; $i < count($review_unit); $i++) {
- $a = $review_unit[$i];
- $ids = $a["review_head"] . ',' . $a["operate_head"] . ',' . $a["operate_team"];
- $ids = explode(",", $ids);
- $c = in_array($this->uid, $ids);
- if ($c) {
- $inarr[] = $a["id"];
- }
- }
- $where = [
- ["cp_cost_project.delete_time", "=", 0],
- ["project_status", ">", 3],
- ["project_status", "<>", 9],
- ["review_unit","=",get_login_admin("unit_name")]
- ];
- $field = $this->Field->get_field_rules_New($this->uid);
- $see_auth = isset($field["see_auth"])?$field["see_auth"]:3;
- $this->see_auth = $see_auth;
- if($see_auth==3){
- $list = $this->Costmodel->where($where)->whereIn("id", $inarr)->column("sent_review_cost");
- $list_ids = $this->Costmodel->where($where)->whereIn("id", $inarr)->column("id,sent_review_cost");
- }elseif ($see_auth==0){
- $list = $this->Costmodel->where($where)->whereIn("id", $inarr)->column("sent_review_cost");
- $list_ids = $this->Costmodel->where($where)->whereIn("id", $inarr)->column("id,sent_review_cost");
- }else{
- $list = $this->Costmodel->where($where)->column("sent_review_cost");
- $list_ids = $this->Costmodel->where($where)->column("id,sent_review_cost");
- }
- $data = Db::name("appropriation")->alias("a")->leftJoin("appropriation_project p","a.id=p.uid")->leftJoin("cost_project c","p.project_id=c.id")
- ->where("p.uid","not null")
- ->where("a.status","2")
- ->where("c.review_unit",get_login_admin("unit_name"))->column("c.id");
- $appropriation = $this->model->where("review_unit", get_login_admin("unit_name"))->where("status","=",2)->select();
- $sent_review_cost = 0;
- $invoicing_amount = 0;
- $appropriation_amount = 0;
- foreach ($list as $item=>$value){
- //送审服务费
- $sent_review_cost += (float)$value;
- $sent_review_cost = number_format($sent_review_cost, 2, '.', '');
- }
- foreach ($appropriation as $item=>$value){
- if($value["invoice_status"]==1){
- //开票金额
- $invoicing_amount += (float)$value["invoicing_amount"];
- $invoicing_amount = number_format($invoicing_amount, 2, '.', '');
- }
- }
- $invoicing_amount = number_format($invoicing_amount, 2, '.', '');
- foreach ($list_ids as $item=>$value){
- //已请款
- if(in_array($value["id"],$data)){
- $appropriation_amount += (float)$value["sent_review_cost"];
- $appropriation_amount = number_format($appropriation_amount, 2, '.', '');
- }
- }
- $appropriation_amount = number_format($appropriation_amount, 2, '.', '');
- //未请款
- $not_appropriation_amount = number_format($sent_review_cost-$appropriation_amount, 2, '.', '');
- //未开票
- $not_invoicing_amount = number_format($sent_review_cost-$invoicing_amount, 2, '.', '');
- View::assign("sent_review_cost",$sent_review_cost);
- View::assign("appropriation_amount",$appropriation_amount);
- View::assign("not_appropriation_amount",$not_appropriation_amount);
- View::assign("invoicing_amount",$invoicing_amount);
- View::assign("not_invoicing_amount",$not_invoicing_amount);
- return view();
- }
- }
- public function add()
- {
- if (request()->isAjax()) {
- $params = get_params();
- $params["appropriation_time"] = time();
- $params["maker_id"] = $this->uid;
- $params["maker_name"] = $this->nickname;
- $params["review_unit"] = get_login_admin("unit_name");
- $params["review_unit_name"] = Db::name("department")->where("id", get_login_admin("unit_name"))->value("title");
- if(empty($params["id"])){
- $insertGetId = $this->model->strict(false)->insertGetId($params);
- if (empty($params["project_ids"])) {
- return to_assign(1, "请添加项目");
- } else {
- Db::name("appropriation_project")->whereIn("id", $params["project_ids"])->update(["uid" => $insertGetId]);
- }
- }else{
- $params["status"] = -1;
- $this->model->where("id",$params["id"])->strict(false)->update($params);
- $insertGetId = $params["id"];
- if (!empty($params["project_ids"])) {
- Db::name("appropriation_project")->whereIn("id", $params["project_ids"])->update(["uid" => $insertGetId]);
- }else {
- $params["project_ids"] = Db::name("appropriation_project")->where("uid",$insertGetId)->column("id");
- }
- }
- if (!empty($params["file_ids"])) {
- $this->filemodel->whereIn("id", $params["file_ids"])->update(["topic_id" => $insertGetId, "module" => "appropriation"]);
- }
- $project_names= '';
- if(!empty($params["project_ids"])){
- $project = Db::name("appropriation_project")->where("uid", $insertGetId)->select();
- if (!$project->isEmpty()) {
- $a = 0;
- $project_name = '';
- foreach ($project as $key => $value) {
- $a += 1;
- $project_name .= $a . "." . $value["project_name"] . ",";
- }
- $project_names = $project_name;
- }
- }
- if (!empty($params["first"])) {
- $auditData = [
- "project_id" => $insertGetId,
- "project_name" => $project_names,
- "project_type" =>"请款审核",
- "audit_name" => "请款一审",
- "audit_type" => 10,
- "sponsor" => get_login_admin("nickname"),
- "sponsor_id" => $this->uid,
- "sponsor_unit" => Db::name("department")->where("id", get_login_admin('unit_name'))->value("title"),
- "approver" => $params["first"],
- "approver_name" => get_admin($params["first"])["nickname"],
- "create_time" => time()
- ];
- $auditDataArr[] = $auditData;
- } else {
- return to_assign(1, "请选择审批人");
- }
- if (!empty($params["second"])) {
- $auditData = [
- "project_id" => $insertGetId,
- "project_name" => $project_names,
- "project_type" =>"请款审核",
- "audit_name" => "请款二审",
- "audit_type" => 11,
- "audit_status"=>5,
- "sponsor" => get_login_admin("nickname"),
- "sponsor_id" => $this->uid,
- "sponsor_unit" => Db::name("department")->where("id", get_login_admin('unit_name'))->value("title"),
- "approver" => $params["second"],
- "approver_name" => get_admin($params["second"])["nickname"],
- "create_time" => time()
- ];
- $auditDataArr[] = $auditData;
- }
- if (!empty($params["third"])) {
- $auditData = [
- "project_id" => $insertGetId,
- "project_name" => $project_names,
- "project_type" =>"请款审核",
- "audit_name" => "请款三审",
- "audit_type" => 12,
- "audit_status"=>5,
- "sponsor" => get_login_admin("nickname"),
- "sponsor_id" => $this->uid,
- "sponsor_unit" => Db::name("department")->where("id", get_login_admin('unit_name'))->value("title"),
- "approver" => $params["third"],
- "approver_name" => get_admin($params["third"])["nickname"],
- "create_time" => time()
- ];
- $auditDataArr[] = $auditData;
- }
- if (!empty($auditDataArr)) {
- $ProjectAudit = new ProjectAudit();
- try {
- $ProjectAudit->saveAll($auditDataArr);
- } catch (\Exception $e) {
- return to_assign(1, '操作失败,原因:' . $e->getMessage());
- }
- }
- return to_assign(0, "操作成功");
- } else {
- return view();
- }
- }
- public function save()
- {
- if (request()->isAjax()) {
- $params = get_params();
- $params["appropriation_time"] = time();
- $params["maker_id"] = $this->uid;
- $params["maker_name"] = $this->nickname;
- $params["review_unit"] = get_login_admin("unit_name");
- $params["review_unit_name"] = Db::name("department")->where("id", get_login_admin("unit_name"))->value("title");
- if(empty($params["id"])){//新建
- $params["status"] = 0;
- $insertGetId = $this->model->strict(false)->insertGetId($params);
- if (empty($params["project_ids"])) {
- return to_assign(1, "请添加项目");
- } else {
- Db::name("appropriation_project")->whereIn("id", $params["project_ids"])->update(["uid" => $insertGetId]);
- }
- if (!empty($params["file_ids"])) {
- $this->filemodel->whereIn("id", $params["file_ids"])->update(["topic_id" => $insertGetId, "module" => "appropriation"]);
- }
- }else{//编辑保存
- $this->model->where("id",$params["id"])->strict(false)->update($params);
- if (!empty($params["project_ids"])) {
- Db::name("appropriation_project")->whereIn("id", $params["project_ids"])->update(["uid" => $params["id"]]);
- }
- if (!empty($params["file_ids"])) {
- $this->filemodel->whereIn("id", $params["file_ids"])->update(["topic_id" => $params["id"], "module" => "appropriation"]);
- }
- }
- return to_assign(0, "操作成功");
- } else {
- return view();
- }
- }
- public function c_edit()
- {
- $params = get_params();
- if (request()->isAjax()) {
- $a= time();
- $id = isset($params["id"]) ? $params["id"] : $a;
- if($id==$a){
- $datas = array();
- $datas["data"] = null;
- return table_assign(0, "无项目", $datas);
- }
- $project = Db::name("appropriation_project")->alias("a")->join("cost_project c",'c.id=a.project_id',"left")->where("a.uid", $id)->field("a.*,c.sent_review_cost")->select();
- $data = [];
- foreach ($project as $item=>$value){
- $value["appropriation_amount"] = $value["sent_review_cost"];
- $data[] = $value;
- }
- $datas["data"] = $data;
- $datas["total"] = count($data);
- return table_assign(0, "", $datas);
- } else {
- $a= time();
- $id = isset($params["id"]) ? $params["id"] : $a;
- $detail = Db::name("appropriation")->where("id",$id)->find();
- $file_array = Db::name('ProjectFile')
- ->field('mf.id,mf.topic_id,mf.admin_id,f.name,f.filesize,f.filepath,f.fileext,f.create_time,f.admin_id,a.nickname as admin_name')
- ->alias('mf')
- ->join('File f', 'mf.file_id = f.id', 'LEFT')
- ->join('Admin a', 'mf.admin_id = a.id', 'LEFT')
- ->order('mf.create_time desc')
- ->where(array('mf.topic_id' => $id, 'mf.module' => 'appropriation'))
- ->select()->toArray();
- View::assign('id',$id);
- View::assign('detail',$detail);
- View::assign('file_array',$file_array);
- return view();
- }
- }
- public function edit_company()
- {
- $params = get_params();
- if (request()->isAjax()) {
- $a= time();
- $id = isset($params["id"]) ? $params["id"] : $a;
- if($id==$a){
- $datas = array();
- $datas["data"] = null;
- return table_assign(0, "无项目", $datas);
- }
- $project = Db::name("appropriation_project")->where("uid", $id)->select();
- $datas["data"] = $project;
- $datas["total"] = count($project);
- return table_assign(0, "", $datas);
- } else {
- $a= time();
- $id = isset($params["id"]) ? $params["id"] : $a;
- $detail = Db::name("appropriation")->where("id",$id)->find();
- $file_array = Db::name('ProjectFile')
- ->field('mf.id,mf.topic_id,mf.admin_id,f.name,f.filesize,f.filepath,f.fileext,f.create_time,f.admin_id,a.nickname as admin_name')
- ->alias('mf')
- ->join('File f', 'mf.file_id = f.id', 'LEFT')
- ->join('Admin a', 'mf.admin_id = a.id', 'LEFT')
- ->order('mf.create_time desc')
- ->where(array('mf.topic_id' => $id, 'mf.module' => 'appropriation'))
- ->select()->toArray();
- View::assign('id',$id);
- View::assign('detail',$detail);
- View::assign('file_array',$file_array);
- return view();
- }
- }
- public function c_read()
- {
- $params = get_params();
- if (request()->isAjax()) {
- $a= time();
- $id = isset($params["id"]) ? $params["id"] : $a;
- if($id==$a){
- $datas = array();
- $datas["data"] = null;
- return table_assign(0, "无项目", $datas);
- }
- $project = Db::name("appropriation_project")->where("uid", $id)->select();
- $datas["data"] = $project;
- $datas["total"] = count($project);
- return table_assign(0, "", $datas);
- }else {
- $a = time();
- $id = isset($params["id"]) ? $params["id"] : $a;
- $detail = Db::name("appropriation")->where("id", $id)->find();
- $file_array = Db::name('ProjectFile')
- ->field('mf.id,mf.topic_id,mf.admin_id,f.name,f.filesize,f.filepath,f.fileext,f.create_time,f.admin_id,a.nickname as admin_name')
- ->alias('mf')
- ->join('File f', 'mf.file_id = f.id', 'LEFT')
- ->join('Admin a', 'mf.admin_id = a.id', 'LEFT')
- ->order('mf.create_time desc')
- ->where(array('mf.topic_id' => $id, 'mf.module' => 'appropriation'))
- ->select()->toArray();
- View::assign('id', $id);
- View::assign('detail', $detail);
- View::assign('file_array', $file_array);
- $audit = Db::name("project_audit")->where("project_id",$id)->select();
- // halt($audit);
- View::assign('audit', $audit);
- return view();
- }
- }
- public function read()
- {
- $params = get_params();
- if (request()->isAjax()) {
- $a= time();
- $id = isset($params["id"]) ? $params["id"] : $a;
- if($id==$a){
- $datas = array();
- $datas["data"] = null;
- return table_assign(0, "无项目", $datas);
- }
- $project = Db::name("appropriation_project")->where("uid", $id)->select();
- $datas["data"] = $project;
- $datas["total"] = count($project);
- return table_assign(0, "", $datas);
- }else {
- $a = time();
- $id = isset($params["id"]) ? $params["id"] : $a;
- $detail = Db::name("appropriation")->where("id", $id)->find();
- $file_array = Db::name('ProjectFile')
- ->field('mf.id,mf.topic_id,mf.admin_id,f.name,f.filesize,f.filepath,f.fileext,f.create_time,f.admin_id,a.nickname as admin_name')
- ->alias('mf')
- ->join('File f', 'mf.file_id = f.id', 'LEFT')
- ->join('Admin a', 'mf.admin_id = a.id', 'LEFT')
- ->order('mf.create_time desc')
- ->where(array('mf.topic_id' => $id, 'mf.module' => 'appropriation'))
- ->select()->toArray();
- View::assign('id', $id);
- View::assign('detail', $detail);
- View::assign('file_array', $file_array);
- $audit = Db::name("project_audit")->where("project_id",$id)->select();
- // halt($audit);
- View::assign('audit', $audit);
- return view();
- }
- }
- public function cc_edit(){
- if (request()->isAjax()) {
- $params = get_params();
- $id = isset($params["id"]) ? $params["id"] : 0;
- $params["audit_time"] = time();
- $params["status"] = 2;
- $this->model->where("id",$id)->update($params);
- return to_assign(0,"操作成功");
- }
- }
- public function disagree(){
- if (request()->isAjax()) {
- $params = get_params();
- $id = isset($params["id"]) ? $params["id"] : 0;
- if(isset($params['reason'])){
- $reason = $params['reason'];
- }else{
- $reason = '';
- }
- $this->model->where("id",$id)->update(["status"=>3,"reason"=>$reason]);
- return to_assign(0,"操作成功");
- }
- }
- public function add_project()
- {
- $params = get_params();
- try {
- $where = [
- ["unit_id","=",get_login_admin("unit_name")],
- ["create_time","<",time()-300],
- ["uid","=",null]
- ];
- Db::name("appropriation_project")->where($where)->delete();
- $params["create_time"] = time();
- $params["unit_id"] = get_login_admin("unit_name");
- $insertGetId = Db::name("appropriation_project")->strict(false)->insertGetId($params);
- } catch (DbException $e) {
- return to_assign(1, '操作失败,原因:' . $e->getMessage());
- }
- return to_assign(0, '操作成功', $insertGetId);
- }
- public function del_project()
- {
- $params = get_params();
- $id = isset($params["id"]) ? $params["id"] : 0;
- try {
- Db::name("appropriation_project")->where("id", $id)->delete();
- } catch (DbException $e) {
- return to_assign(1, '操作失败,原因:' . $e->getMessage());
- }
- return to_assign(0, '操作成功');
- }
- public function project_list()
- {
- $params = get_params();
- $ids = isset($params["id"]) ? $params["id"] : array();
- $data = Db::name("appropriation_project")->whereIn("id", $ids)->select();
- $datas["data"] = $data;
- $datas["total"] = count($data);
- return table_assign(0, "", $datas);
- }
- public function project_list_c()
- {
- $params = get_params();
- $ids = isset($params["id"]) ? $params["id"] : array();
- $data = Db::name("appropriation_project")->whereIn("id", $ids)->select();
- $datas["data"] = $data;
- $datas["total"] = count($data);
- return table_assign(0, "", $datas);
- }
- public function edit()
- {
- $params = get_params();
- $id = isset($params["id"]) ? $params["id"] : 0;
- $params["refund_time"] = time();
- try {
- Db::name("appropriation_project")->where("id", $id)->update($params);
- } catch (DbException $e) {
- return to_assign(1, '操作失败,原因:' . $e->getMessage());
- }
- return to_assign(0, '操作成功');
- }
- public function edit_c()
- {
- $params = get_params();
- $id = isset($params["id"]) ? $params["id"] : 0;
- try {
- Db::name("appropriation_project")->where("id", $id)->update($params);
- } catch (DbException $e) {
- return to_assign(1, '操作失败,原因:' . $e->getMessage());
- }
- return to_assign(0, '操作成功');
- }
- }
|