why.xingtongworld.com项目
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

96 lines
3.4 KiB

<?php
/**
* Created by PhpStorm.
* User: Administrator
* Date: 2018/3/21
* Time: 9:28
*/
namespace app\api\controller;
use think\Db;
use think\Request;
use think\Cache;
use think\Validate;
use app\api\config;
class Finance
{
public function getOne(Request $request)
{
$id = $request->param('id');
if (empty($id)) {
return json_encode(['code' => 500, 'msg' => '参数错误', 'data' => []], JSON_UNESCAPED_UNICODE);
}
$data = Db::name('finance')
->field('c_name,c_jcname,c_code,c_price,c_logo,c_status,c_order,c_gptime,c_infostime,c_infoetime,c_jump,c_content')
->where('c_id', $id)->find();
return json_encode(['code' => 200, 'msg' => '', 'data' => $data ?? [] ], JSON_UNESCAPED_UNICODE);
}
public function gitList(Request $request){
$kind=$request->param('kind');
$types = array();
$page=15;
if($kind == 3){
$types=config('finance.types');
}
if($kind == 9){
$types=[1=>'望拍第一期','朔拍第一期','望拍第二期','望拍第三期','朔望联拍','朔拍第二期','朔拍第三期','宝安收藏家协会拍卖专场','清末之光·民国之魂',12=>'会员回馈——名酒名品内部拍卖会'];
}
if($kind == 5){
$types=config('finance.art_types');
}
if($kind == 6){
$types=config('finance.art_enjoy');
}
if(in_array($kind,[7,8])){
$page=18;
}
$data= array();
if($types){
foreach ($types as $key=>$type){
$where = array(
'c_kind' => $kind
);
if($kind==9){
$where['c_parent'] = $key;
}else{
$where['c_type'] = $key;
}
$db=Db::name('finance')->where($where);
$gp_list=$db->field('c_id,c_name,c_jcname,c_code,c_price,c_gprice,c_logo,c_status,c_order,c_gptime,c_infostime,c_infoetime,c_jump')
->order('c_order,c_time desc')->paginate($page,false,['query'=>get_query()]);
if($gp_list){
$gp_list = $gp_list->toArray();
}
$data[$key]['type'] = $key;
$data[$key]['type_name'] = $type;
$data[$key]['list'] = $gp_list['data'];
}
}else{
$where = array(
'c_kind' => $kind
);
$db=Db::name('finance')->where($where);
$gp_list=$db->field('c_id,c_name,c_jcname,c_code,c_price,c_gprice,c_logo,c_status,c_order,c_gptime,c_infostime,c_infoetime,c_jump,c_content')
->order('c_order,c_time desc')->paginate($page,false,['query'=>get_query()]);
if($gp_list){
$gp_list = $gp_list->toArray();
}
$data = $gp_list['data'];
}
return json_encode(['code' => 200, 'msg' => '', 'data' => $data ?? [] ], JSON_UNESCAPED_UNICODE);
}
public function gitDataById(Request $request){
$kind=$request->param('kind');
$id=$request->param('id');
$where = array(
'c_kind' => $kind,
'c_id' => $id
);
$data = Db::name('finance')->where('c_id', $id)->find();
return json_encode(['code' => 200, 'msg' => '', 'data' => $data ?? [] ], JSON_UNESCAPED_UNICODE);
}
}