This commit is contained in:
mkm 2023-08-24 11:21:33 +08:00
parent ef55f2dfbb
commit 049c3adada
3 changed files with 84 additions and 19 deletions

View File

@ -16,6 +16,7 @@ namespace app\api\controller;
use app\api\logic\IndexLogic;
use app\common\model\company\CompanyProperty;
use think\facade\Db;
use think\facade\Log;
use think\response\Json;
@ -30,7 +31,7 @@ class IndexController extends BaseApiController
{
public array $notNeedLogin = ['index', 'config', 'policy', 'decorate','notifyUrl'];
public array $notNeedLogin = ['index', 'config', 'policy', 'decorate', 'notifyUrl','notifyProperty'];
/**
@ -92,29 +93,60 @@ class IndexController extends BaseApiController
return $this->data($result);
}
public function notifyUrl(){
$a= Request()->get();
if($a){
$find=Db::name('contract')->where('id',$a['id'])->find();
if($find){
if($find['signing_timer']==0){
Db::name('contract')->where('id',$a['id'])->update(['signing_timer'=>1]);
/**签约回调 */
public function notifyUrl()
{
$a = Request()->get();
if ($a) {
$find = Db::name('contract')->where('id', $a['id'])->find();
if ($find) {
if ($find['signing_timer'] == 0) {
Db::name('contract')->where('id', $a['id'])->update(['signing_timer' => 1]);
return true;
}else if($find['signing_timer']==1){
Db::name('contract')->where('id',$a['id'])->update(['status'=>1,'signing_timer'=>2]);
if($find['type']==1){
Db::name('company')->where('id',$find['party_a'])->update(['status'=>1,'is_contract'=>1]);
Db::name('company')->where('id',$find['party_b'])->update(['status'=>1,'is_contract'=>1]);
}else{
Db::name('company')->where('id',$find['party_a'])->update(['status'=>1,'is_contract'=>1]);
Db::name('user')->where('id',$find['party_b'])->update(['is_contract'=>1]);
} else if ($find['signing_timer'] == 1) {
Db::name('contract')->where('id', $a['id'])->update(['status' => 1, 'signing_timer' => 2]);
if ($find['type'] == 1) {
Db::name('company')->where('id', $find['party_a'])->update(['status' => 1, 'is_contract' => 1]);
Db::name('company')->where('id', $find['party_b'])->update(['status' => 1, 'is_contract' => 1]);
} else {
Db::name('company')->where('id', $find['party_a'])->update(['status' => 1, 'is_contract' => 1]);
Db::name('user')->where('id', $find['party_b'])->update(['is_contract' => 1]);
}
}
curl_post('http://logistics.lihaink.cn/api/updateRentRecord',[],['contract_id'=>$a['id']]);
curl_post('http://logistics.lihaink.cn/api/updateRentRecord', [], ['contract_id' => $a['id']]);
}
}
return json(['success'=>true,'msg'=>'成功']);
return json(['success' => true, 'msg' => '成功']);
}
}
public function notifyProperty()
{
$parmas = Request()->post();
if ($parmas) {
if (!isset($parmas['company_id']) || $parmas['company_id'] < 0) {
return json(['success' => false, 'msg' => '公司id不能为空']);
}
if (!isset($parmas['object_id'])) {
return json(['success' => false, 'msg' => '对象id不能为空']);
}
$data=[];
foreach($parmas['object_id'] as $k=>$v){
if($v>0){
$data[$k]['company_id']=$parmas['company_id'];
$data[$k]['object_id']=$parmas['object_id'];
$data[$k]['type']=1;
}
}
if (count($data)>0){
$res = CompanyProperty::insertAll($data);
}
if ($res) {
return json(['success' => true, 'msg' => '成功']);
} else {
return json(['success' => false, 'msg' => '失败']);
}
}
return json(['success' => false, 'msg' => '失败,没有参数']);
}
}

View File

@ -0,0 +1,32 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\common\model\company;
use think\model\concern\SoftDelete;
use app\common\model\BaseModel;
/**
* 公司资产模型
* Class CompanyProperty
* @package app\common\model
*/
class CompanyProperty extends BaseModel
{
use SoftDelete;
protected $deleteTime = 'delete_time';
}

View File

@ -35,4 +35,5 @@ Route::rule('crontab', function () {
});
Route::post('/notify_url', IndexController::class . '@notifyUrl');
Route::post('/v1/notify_property',IndexController::class . '@notifyProperty');
Route::get('/api/junziqian/download_file',JunziqianController::class . '@download_file');