610 lines
25 KiB
PHP
Executable File
610 lines
25 KiB
PHP
Executable File
<?php
|
|
|
|
namespace app\api\controller;
|
|
|
|
use app\common\basics\Api;
|
|
use app\common\model\goods\GoodsCategory;
|
|
use app\common\model\procurement\Mprocurement;
|
|
use app\common\model\procurement\Procurementset;
|
|
use app\common\model\procurement\Procurementxyrecord;
|
|
use app\common\model\procurement\Procurementxy;
|
|
use app\common\model\procurement\Procurementxydt;
|
|
use app\common\model\procurement\Procurementxyset;
|
|
use app\common\model\procurement\Procurementxyallprice;
|
|
use app\common\model\procurement\Procurementxyprice;
|
|
use app\common\model\procurement\Procurementtreaty;
|
|
use app\common\model\procurement\Procurementxyrpay;
|
|
use app\common\model\procurement\Procurementxptreaty;
|
|
use app\common\model\user\User;
|
|
use app\common\server\ConfigServer;
|
|
use app\common\server\JsonServer;
|
|
use app\common\server\storage\Driver as StorageDriver;
|
|
use app\common\server\UrlServer;
|
|
use app\common\server\WeChatServer;
|
|
use EasyWeChat\Factory;
|
|
use think\Exception;
|
|
use think\facade\Request;
|
|
|
|
class Procurement extends Api
|
|
{
|
|
public $like_not_need_login = ['checkProcurement'];
|
|
/**
|
|
* showdoc
|
|
* @catalog 接口/上传文件
|
|
* @title form表单方式上传图片
|
|
* @description 图片上传
|
|
* @method post
|
|
* @url /file/formimage
|
|
* @return param name string 图片名称
|
|
* @return param url string 文件地址
|
|
* @remark
|
|
* @number 1
|
|
* @return {"code":1,"msg":"上传文件成功","data":{"url":"http:\/\/likeb2b2c.yixiangonline.com\/uploads\/images\/procurement\/20200810\/3cb866f6bb30b7239d91582f7d9822d6.png","name":"2.png"},"show":0,"time":"0.283254","debug":{"request":{"get":[],"post":[],"header":{"content-length":"103132","content-type":"multipart\/form-data; boundary=--------------------------206668736604428806173438","connection":"keep-alive","accept-encoding":"gzip, deflate, br","host":"www.likeb2b2c.com:20002","postman-token":"1f8aa4dd-f53c-4d12-98b4-8d901ac847db","cache-control":"no-cache","accept":"*\/*","procurement-agent":"PostmanRuntime\/7.26.2"}}}}
|
|
*/
|
|
public function formImage()
|
|
{
|
|
try{
|
|
$data = $this->image( 'uploads/procurement/'.$this->user_id);
|
|
return JsonServer::success('上传成功', $data);
|
|
}catch(\Exception $e) {
|
|
return JsonServer::error($e->getMessage());
|
|
}
|
|
|
|
}
|
|
|
|
public static function image($save_dir='uploads/procurement')
|
|
{
|
|
try {
|
|
// 1、获取当前存储对象
|
|
$config = [
|
|
'default' => ConfigServer::get('storage', 'default', 'local'),
|
|
'engine' => ConfigServer::get('storage_engine') ?? ['local'=>[]]
|
|
];
|
|
|
|
// 2、执行文件上传
|
|
$StorageDriver = new StorageDriver($config);
|
|
$StorageDriver->setUploadFile('file');
|
|
if (!$StorageDriver->upload($save_dir)) throw new Exception($StorageDriver->getError());
|
|
$fileName = $StorageDriver->getFileName();
|
|
$fileInfo = $StorageDriver->getFileInfo();
|
|
|
|
// 3、处理文件名称
|
|
if (strlen($fileInfo['name']) > 128) {
|
|
$file_name = substr($fileInfo['name'], 0, 123);
|
|
$file_end = substr($fileInfo['name'], strlen($fileInfo['name'])-5, strlen($fileInfo['name']));
|
|
$fileInfo['name'] = $file_name.$file_end;
|
|
}
|
|
$file['uri'] = $save_dir . '/' . str_replace("\\","/", $fileName);
|
|
// 5、返回结果
|
|
return [
|
|
'uri' => UrlServer::getFileUrl($file['uri']),
|
|
'base_uri' => clearDomain($file['uri'])
|
|
];
|
|
} catch (\Exception $e) {
|
|
throw new Exception($e->getMessage());
|
|
}
|
|
}
|
|
/**
|
|
* 查询是否存在集采信息
|
|
*/
|
|
public function checkProcurement()
|
|
{
|
|
$user_id = $this->user_id;
|
|
if($user_id!=0){
|
|
$procurement = Mprocurement::where("user_id",$user_id)->where("u_state",1)->find();
|
|
if($procurement != null){
|
|
return JsonServer::success('获取成功', ['content' => $procurement]);
|
|
}else{
|
|
return JsonServer::error('暂无数据',[],0,0);
|
|
}
|
|
}else{
|
|
return JsonServer::error('参数错误');
|
|
}
|
|
// $data = ProcurementLogic::getprocurement($this->user_id);
|
|
|
|
}
|
|
/**
|
|
* 提交集采人员信息
|
|
*/
|
|
public function add()
|
|
{
|
|
|
|
if($this->request->isPost()) {
|
|
// var_dump($this->request->post());die;
|
|
$data['user_id']= $this->user_id;
|
|
$procurement = Mprocurement::where("user_id",$data['user_id'])->where("u_state <> 2")->find();
|
|
$data['u_image']= $this->request->post('u_image')[0];
|
|
$data['u_front']= $this->request->post('u_front')[0];
|
|
$data['u_opposite']= $this->request->post('u_opposite')[0];
|
|
$data['u_name']= $this->request->post('u_name');
|
|
$data['u_phone']= $this->request->post('u_phone');
|
|
$data['province_id']= $this->request->post('province_id');
|
|
$data['city_id']= $this->request->post('city_id');
|
|
$data['area_id']= $this->request->post('area_id');
|
|
$data['province_name']= $this->request->post('province_name');
|
|
$data['city_name']= $this->request->post('city_name');
|
|
$data['area_name']= $this->request->post('area_name');
|
|
$data['u_address']= $this->request->post('u_address');
|
|
$data['u_update']= date('Y-m-d H:i:s');
|
|
$data['u_dtime']= date('Y-m-d H:i:s');
|
|
if($procurement != null){
|
|
$data['u_examine_state']= 0;
|
|
$result = Mprocurement::where("user_id",$data['user_id'])->where("u_state <> 2")->update($data);
|
|
}else{
|
|
$MprocurementModel = new Mprocurement();
|
|
$result = $MprocurementModel->save($data);
|
|
}
|
|
if($result){
|
|
return JsonServer::success('上传成功');
|
|
}else{
|
|
return JsonServer::error('上传失败');
|
|
}
|
|
}else{
|
|
return JsonServer::error('参数丢失');
|
|
}
|
|
|
|
|
|
// $data = ProcurementLogic::getprocurement($this->user_id);
|
|
|
|
}
|
|
/**
|
|
* 提交集采设置的集采价格和代发价格
|
|
*/
|
|
public function addSet()
|
|
{
|
|
|
|
if($this->request->isPost()) {
|
|
$user_id = $this->user_id;
|
|
$procurement = Mprocurement::where("user_id",$user_id)->where("u_examine_state",1)->where("u_state",1)->find();
|
|
if($procurement == null){
|
|
return JsonServer::error('非法人员无法提交');
|
|
}
|
|
$data['u_id']= $procurement['u_id'];
|
|
$data['price_type']= $this->request->post('price_type',0);
|
|
$data['set_pro_type']= $this->request->post('set_pro_type',0);
|
|
$data['set_pro']= $this->request->post('set_pro',0);
|
|
$data['set_issued_type']= $this->request->post('set_issued_type',0);
|
|
$data['set_issued']= $this->request->post('set_issued',0);
|
|
$data['set_wholesale_type']= $this->request->post('set_wholesale_type',0);
|
|
$data['set_wholesale']= $this->request->post('set_wholesale',0);
|
|
$data['goods_onetype']= $this->request->post('goods_onetype',0);
|
|
$data['goods_twotype']= $this->request->post('goods_twotype',0);
|
|
$data['set_update']= date('Y-m-d H:i:s');
|
|
$data['set_dtime']= date('Y-m-d H:i:s');
|
|
// var_dump($data);die;
|
|
|
|
$MprocurementsetModel = new Procurementset();
|
|
$result = $MprocurementsetModel->insertGetId($data);
|
|
if($result){
|
|
$d['set_id'] = $result;
|
|
$d['p_id'] = $procurement['u_id'];
|
|
return JsonServer::success('上传成功', $d);
|
|
}else{
|
|
return JsonServer::error('上传失败');
|
|
}
|
|
}else{
|
|
return JsonServer::error('参数丢失');
|
|
}
|
|
|
|
}
|
|
/**
|
|
*生成微信二维码
|
|
*/
|
|
public function makeWxImage(){
|
|
$url = $this->request->get('url');
|
|
$user_id = $this->user_id;
|
|
$setId= $this->request->get('set_id');
|
|
$procurement = Mprocurement::where("user_id",$user_id)->where("u_examine_state",1)->where("u_state",1)->find();
|
|
$user_msg = User::where("id",$user_id)->where("del",0)->where("disable",0)->find();
|
|
if($user_msg==null){
|
|
return JsonServer::error('暂无用户');
|
|
}
|
|
if ($procurement!=null && $url) {
|
|
$save_dir = ROOT_PATH .'/uploads/wximage/';
|
|
$scene = 'id='.$procurement['u_id'].'&set='.$setId.'&icde='.$user_msg['distribution_code'];
|
|
$a = time().$procurement['u_id'];
|
|
$qr_src = $a . '.jpg';
|
|
}else{
|
|
return JsonServer::error('参数丢失');
|
|
}
|
|
try {
|
|
$config = WeChatServer::getMnpConfig();
|
|
$app = Factory::miniProgram($config);
|
|
|
|
$response = $app->app_code->getUnlimit($scene, [
|
|
'page' => $url
|
|
// 'env_version' => 'trial',
|
|
// 'env_version' => 'develop'
|
|
]);
|
|
// print_r("<pre>");
|
|
// var_dump($response);die;
|
|
if ($response instanceof \EasyWeChat\Kernel\Http\StreamResponse) {
|
|
$response->saveAs($save_dir, $a);
|
|
$us = Request::instance()->domain();
|
|
$d['set_image'] = $data['url'] = $us.'/uploads/wximage/'.$qr_src;
|
|
$d['set_update']= date('Y-m-d H:i:s');
|
|
$set = Procurementset::where("set_id",$setId)->update($d);
|
|
if($set){
|
|
return JsonServer::success('上传成功',$data);
|
|
}else{
|
|
return JsonServer::error('上传失败');
|
|
}
|
|
}
|
|
if(isset($response['errcode']) && 41030 === $response['errcode']){
|
|
return '商城小程序未上线或商城小程序页面发布';
|
|
}
|
|
return $response['errmsg'];
|
|
} catch (\EasyWeChat\Kernel\Exceptions\Exception $e){
|
|
|
|
return $e->getMessage();
|
|
|
|
}
|
|
|
|
}
|
|
/**
|
|
*生成推广微信二维码
|
|
*/
|
|
public function makeMyWxImage(){
|
|
$user_id = $this->user_id;
|
|
// $url = $this->request->get('url');
|
|
$user_msg = User::where("id",$user_id)->where("del",0)->where("disable",0)->find();
|
|
if($user_msg==null){
|
|
return JsonServer::error('暂无用户');
|
|
}
|
|
// if ($user_msg['wx_image']!=null && $user_msg['wx_image']!="") {
|
|
// $data['wx_image'] = $user_msg['wx_image'];
|
|
// return JsonServer::success('查询成功',$data);
|
|
// }else{
|
|
$url = "pages/index/index";
|
|
$save_dir = ROOT_PATH .'/uploads/wximage/';
|
|
$scene = 'invite_code='.$user_msg['distribution_code'];
|
|
$a = time().$user_msg['distribution_code'];
|
|
$qr_src = $a . '.jpg';
|
|
// }
|
|
try {
|
|
$config = WeChatServer::getMnpConfig();
|
|
$app = Factory::miniProgram($config);
|
|
|
|
$response = $app->app_code->getUnlimit($scene, [
|
|
'page' => $url
|
|
// 'env_version' => 'trial'
|
|
// 'env_version' => 'develop'
|
|
]);
|
|
// print_r("<pre>");
|
|
// var_dump($response);die;
|
|
if ($response instanceof \EasyWeChat\Kernel\Http\StreamResponse) {
|
|
$response->saveAs($save_dir, $a);
|
|
$us = Request::instance()->domain();
|
|
$data['wx_image'] = $us.'/uploads/wximage/'.$qr_src;
|
|
$user_msg = User::where("id",$user_id)->update($data);
|
|
if($user_msg){
|
|
return JsonServer::success('查询成功',$data);
|
|
}else{
|
|
return JsonServer::error('查询失败');
|
|
}
|
|
}
|
|
|
|
if(isset($response['errcode']) && 41030 === $response['errcode']){
|
|
return '商城小程序未上线或商城小程序页面发布';
|
|
}
|
|
return $response['errmsg'];
|
|
} catch (\EasyWeChat\Kernel\Exceptions\Exception $e){
|
|
|
|
return $e->getMessage();
|
|
|
|
}
|
|
|
|
}
|
|
/**
|
|
* 查询设置的采集信息
|
|
*/
|
|
public function checkSetList()
|
|
{
|
|
$user_id = $this->user_id;
|
|
if($user_id!=0){
|
|
$procurement = Mprocurement::where("user_id",$user_id)->where("u_state",1)->where("u_examine_state",1)->find();
|
|
if($procurement){
|
|
$set = Procurementset::where("u_id",$procurement['u_id'])->where("set_state",1)->order("set_update desc")->limit(1)->find();
|
|
if($set != null){
|
|
$data['set_image'] = $set['set_image'];
|
|
$data['p_id'] = $procurement['u_id'];
|
|
$data['set'] = $set['set_id'];
|
|
return JsonServer::success('获取成功', $data);
|
|
}else{
|
|
return JsonServer::error('暂无数据');
|
|
}
|
|
}else{
|
|
return JsonServer::error('暂无数据');
|
|
}
|
|
}else{
|
|
return JsonServer::error('参数错误');
|
|
}
|
|
}
|
|
/**
|
|
* 查询信用消费列表
|
|
*/
|
|
public function checkProxy()
|
|
{
|
|
$user_id = $this->user_id;
|
|
if($user_id!=0){
|
|
$xy = Procurementxy::where("user_id",$user_id)->where("xy_state",1)->find();
|
|
if($xy!=null){
|
|
$record = Procurementxyrecord::where("user_id",$user_id)->where("record_state",1)->order("record_dtime desc")->select();
|
|
if(!empty($record)){
|
|
$data['xy_price'] = $xy['xy_price'];
|
|
$data['record'] = $record;
|
|
return JsonServer::success('获取成功', $data);
|
|
}else{
|
|
return JsonServer::error('暂无数据');
|
|
}
|
|
}else{
|
|
return JsonServer::error('暂无额度');
|
|
}
|
|
}else{
|
|
return JsonServer::error('参数错误');
|
|
}
|
|
}
|
|
/**
|
|
* 还款
|
|
*/
|
|
public function payReturn()
|
|
{
|
|
$user_id = $this->user_id;
|
|
if($user_id!=0){
|
|
$xy = Procurementxy::where("user_id",$user_id)->where("xy_state",1)->find();
|
|
if($xy!=null){
|
|
if($xy['xy_y_price'] != 0){
|
|
$data['xy_y_price'] = $xy['xy_y_price'];
|
|
$data['xy_ap_state'] = $xy['xy_ap_state'];
|
|
return JsonServer::success('获取成功', $data);
|
|
}else{
|
|
return JsonServer::error('暂无还款');
|
|
}
|
|
}else{
|
|
return JsonServer::error('暂无额度');
|
|
}
|
|
|
|
}else{
|
|
return JsonServer::error('参数错误');
|
|
}
|
|
}
|
|
/**
|
|
* 提交申请批发价
|
|
*/
|
|
public function subWholesale()
|
|
{
|
|
$user_id = $this->user_id;
|
|
if($user_id!=0){
|
|
$procurement = Mprocurement::where("user_id",$user_id)->where("u_state",1)->where("u_examine_state",1)->where("wholesale_state in(0,3)")->find();
|
|
if($procurement != null){
|
|
$result = Mprocurement::where("user_id",$user_id)->update(['wholesale_state'=>1]);
|
|
if($result){
|
|
return JsonServer::success('提交成功');
|
|
}else{
|
|
return JsonServer::error('提交失败');
|
|
}
|
|
}else{
|
|
return JsonServer::error('请先申请成为集采人员');
|
|
}
|
|
}else{
|
|
return JsonServer::error('参数错误');
|
|
}
|
|
// $data = ProcurementLogic::getprocurement($this->user_id);
|
|
}
|
|
/**
|
|
* 查询分期日期
|
|
*/
|
|
public function checkDt()
|
|
{
|
|
$result = Procurementxydt::where("dt_state",1)->select();
|
|
if(!empty($result)){
|
|
$data['data'] = $result;
|
|
return JsonServer::success('查询成功',$data);
|
|
}else{
|
|
return JsonServer::error('暂无数据');
|
|
}
|
|
// $data = ProcurementLogic::getprocurement($this->user_id);
|
|
}
|
|
/**
|
|
* 查询分期内容
|
|
*/
|
|
public function byStages()
|
|
{
|
|
$user_id = $this->user_id;
|
|
$dt = $this->request->get('dt');
|
|
$procurementxy = Procurementxy::where("user_id",$user_id)->where("xy_y_state",1)->where("xy_state",1)->find();
|
|
if($procurementxy!=null){
|
|
$procurementxyset = Procurementxyset::where("s_state",1)->find();
|
|
if($procurementxyset == null){
|
|
return JsonServer::error('暂无数据');
|
|
}
|
|
$f = round($procurementxy['xy_y_price']/$dt,2);
|
|
$arr = array();
|
|
for($i=0;$i<$dt;$i++){
|
|
$x = $i + 1;
|
|
if($i+1 == $dt){
|
|
$p = round($procurementxy['xy_y_price']- $i*$f,2);
|
|
$p1 = round($p*$procurementxyset['s_content'],2);
|
|
$arr[$i]['xp_price'] = $p;
|
|
$arr[$i]['xp_interest'] = $p1;
|
|
$arr[$i]['xp_aprice'] = round($p + $p1,2);
|
|
$arr[$i]['xp_price_time'] = date("Y-m-d",strtotime("+".$x."month") );
|
|
}else{
|
|
$p1 = round($f*$procurementxyset['s_content'],2);;
|
|
$arr[$i]['xp_price'] = $f;
|
|
$arr[$i]['xp_interest'] = $p1;
|
|
$arr[$i]['xp_aprice'] = round($f+$p1,2);
|
|
$arr[$i]['xp_price_time'] = date("Y-m-d",strtotime("+".$x."month") );
|
|
}
|
|
}
|
|
$data['data'] = $arr;
|
|
return JsonServer::success('查询成功',$data);
|
|
}else{
|
|
return JsonServer::error('当前无需还款');
|
|
}
|
|
}
|
|
// 提交分期
|
|
public function byStagesSubmit()
|
|
{
|
|
$user_id = $this->user_id;
|
|
$dt = $this->request->get('dt');
|
|
$procurementxy = Procurementxy::where("user_id",$user_id)->where("xy_y_state",1)->where("xy_state",1)->find();
|
|
if($procurementxy!=null){
|
|
if($procurementxy['xy_ap_state'] == 1){
|
|
return JsonServer::error('当前还有额度未归还,请先归还额度');
|
|
}
|
|
$procurementxyset = Procurementxyset::where("s_state",1)->find();
|
|
if($procurementxyset == null){
|
|
return JsonServer::error('暂无数据');
|
|
}
|
|
$f = round($procurementxy['xy_y_price']/$dt,2);
|
|
$arr = array();
|
|
for($i=0;$i<$dt;$i++){
|
|
$x = $i + 1;
|
|
if($i+1 == $dt){
|
|
$p = rand($procurementxy['xy_y_price']- $i*$f,2);
|
|
$p1 = round($p*$procurementxyset['s_content'],2);
|
|
$arr[$i]['xp_price'] = $p;
|
|
$arr[$i]['xp_interest'] = $p1;
|
|
$arr[$i]['xp_aprice'] = $p + $p1;
|
|
$arr[$i]['xp_dtime'] = date("Y-m-d H:i:s");
|
|
$arr[$i]['xp_price_time'] = date("Y-m-d",strtotime("+".$x."month") );
|
|
}else{
|
|
$p1 = round($f*$procurementxyset['s_content'],2);;
|
|
$arr[$i]['xp_price'] = $f;
|
|
$arr[$i]['xp_interest'] = $p1;
|
|
$arr[$i]['xp_aprice'] = $f+$p1;
|
|
$arr[$i]['xp_dtime'] = date("Y-m-d H:i:s");
|
|
$arr[$i]['xp_price_time'] = date("Y-m-d",strtotime("+".$x."month") );
|
|
}
|
|
}
|
|
$re_procurementxy = Procurementxy::where("user_id",$user_id)->update(['xy_ap_state'=>1]);
|
|
if(!$re_procurementxy){
|
|
return JsonServer::error('数据出现错误');
|
|
}
|
|
$procurementxyallpriceModel = new Procurementxyallprice();
|
|
$data['user_id'] = $user_id;
|
|
$data['xy_price'] = $procurementxy['xy_y_price'];
|
|
$data['xy_interest'] = $procurementxy['xy_y_price']*$procurementxyset['s_content'];
|
|
$data['xy_allprice'] = $data['xy_interest'] + $procurementxy['xy_y_price'];
|
|
$data['xy_qishu'] = $dt;
|
|
$data['ap_dtime'] = date("Y-m-d H:i:s");
|
|
$ap_id = $procurementxyallpriceModel->insertGetId($data);
|
|
if(!$ap_id){
|
|
return JsonServer::error('数据异常');
|
|
}
|
|
$procurementxypriceModel = new Procurementxyprice();
|
|
if(!empty($arr)){
|
|
foreach($arr as $key=>$value){
|
|
$arr[$key]['ap_id'] = $ap_id;
|
|
}
|
|
$procurementxypriceModel->saveall($arr);
|
|
}
|
|
return JsonServer::success('分期成功');
|
|
}else{
|
|
return JsonServer::error('当前无需还款');
|
|
}
|
|
}
|
|
// 一次结清
|
|
public function checkSettleStages()
|
|
{
|
|
$user_id = $this->user_id;
|
|
$procurementxyallprice= Procurementxyallprice::where("user_id",$user_id)->where("ap_state",0)->find();
|
|
if($procurementxyallprice!=null){
|
|
$procurementxyprice= Procurementxyprice::where("ap_id",$procurementxyallprice['ap_id'])->where('xp_state',0)->select();
|
|
$total =$xp_price=$xp_interest= "0.00";
|
|
foreach($procurementxyprice as $key=>$value){
|
|
$total+= $value['xp_aprice'];
|
|
$xp_price+= $value['xp_price'];
|
|
$xp_interest+= $value['xp_interest'];
|
|
}
|
|
$data['xp_aprice'] = round($total,2);
|
|
$data['xp_price'] = round($xp_price,2);
|
|
$data['xp_interest'] = round($xp_interest,2);
|
|
return JsonServer::success('查询成功',$data);
|
|
}else{
|
|
$procurementxy = Procurementxy::where("user_id",$user_id)->where("xy_y_state",1)->where("xy_state",1)->find();
|
|
if($procurementxy!=null){
|
|
$data['xp_aprice'] = $procurementxy['xy_y_price'];
|
|
$data['xp_price'] = $procurementxy['xy_y_price'];
|
|
$data['xp_interest'] = "0.00";
|
|
return JsonServer::success('查询成功',$data);
|
|
}else{
|
|
return JsonServer::error('当前无需还款');
|
|
}
|
|
}
|
|
|
|
}
|
|
// 查询当前还款
|
|
public function checkNowxy(){
|
|
$user_id = $this->user_id;
|
|
$procurementxyallprice= Procurementxyallprice::where("user_id",$user_id)->where("ap_state",0)->find();
|
|
if($procurementxyallprice!=null){
|
|
$procurementxyprice= Procurementxyprice::where("ap_id",$procurementxyallprice['ap_id'])->select();
|
|
$procurementxyprice = json_decode($procurementxyprice);
|
|
return JsonServer::success('查询成功',$procurementxyprice);
|
|
}else{
|
|
return JsonServer::error('暂无记录');
|
|
}
|
|
}
|
|
// 查询还款记录
|
|
public function checkNowxyList(){
|
|
$user_id = $this->user_id;
|
|
$procurementxyrpay= Procurementxyrpay::where("user_id",$user_id)->where('rpay_state',1)->order("dtime desc")->select();
|
|
if(!empty($procurementxyrpay)){
|
|
$procurementxyrpay = json_decode($procurementxyrpay);
|
|
return JsonServer::success('查询成功',$procurementxyrpay);
|
|
}else{
|
|
return JsonServer::error('暂无记录');
|
|
}
|
|
}
|
|
// 查询协议
|
|
public function checkTreaty()
|
|
{
|
|
$procurementtreaty = Procurementtreaty::where("id",1)->find();
|
|
if($procurementtreaty != null){
|
|
$data['id'] = $procurementtreaty['id'];
|
|
$data['type'] = $procurementtreaty['type'];
|
|
$data['name'] = $procurementtreaty['name'];
|
|
$data['content'] = $procurementtreaty['content'];
|
|
$data['create_time'] = $procurementtreaty['create_time'];
|
|
$data['update_time'] = $procurementtreaty['update_time'];
|
|
return JsonServer::success('查询成功',$data);
|
|
}else{
|
|
return JsonServer::error('暂无协议');
|
|
}
|
|
}
|
|
// 查询使用信用支付协议
|
|
public function checkXpTreaty()
|
|
{
|
|
$procurementtreaty = Procurementxptreaty::where("id",1)->find();
|
|
if($procurementtreaty != null){
|
|
$data['id'] = $procurementtreaty['id'];
|
|
$data['type'] = $procurementtreaty['type'];
|
|
$data['name'] = $procurementtreaty['name'];
|
|
$data['content'] = $procurementtreaty['content'];
|
|
$data['create_time'] = $procurementtreaty['create_time'];
|
|
$data['update_time'] = $procurementtreaty['update_time'];
|
|
return JsonServer::success('查询成功',$data);
|
|
}else{
|
|
return JsonServer::error('当前不是集采人员,请先成为集采人员');
|
|
}
|
|
}
|
|
// 提交信用支付审核
|
|
public function subXpExamine()
|
|
{
|
|
$user_id = $this->user_id;
|
|
$User = User::where("id",$user_id)->where("disable",0)->find();
|
|
if($User != null){
|
|
$data['xp_price_state'] = 1;
|
|
$u = User::where("id",$user_id)->update($data);
|
|
if($u){
|
|
return JsonServer::success('提交成功');
|
|
}else{
|
|
return JsonServer::success('提交失败');
|
|
}
|
|
}else{
|
|
return JsonServer::error('非法用户');
|
|
}
|
|
}
|
|
} |