This commit is contained in:
mkm 2023-08-07 12:00:27 +08:00
parent 474f1858c1
commit 62d68b853e
4 changed files with 92 additions and 44 deletions

View File

@ -55,7 +55,8 @@ class UserInformationgLists extends BaseAdminDataLists implements ListsSearchInt
public function lists(): array
{
$lists = UserInformationg::where($this->searchWhere)
->field(['id', 'area_id','area_id area_name','street_id','street_id street_name','village_id','village_id village_name', 'brigade_id','brigade_id brigade_name', 'address', 'name', 'phone', 'sex', 'age', 'status'])
->field(['id','create_user_id','company_id','area_id','area_id area_name','street_id','street_id street_name','village_id','village_id village_name', 'brigade_id','brigade_id brigade_name', 'address', 'name', 'phone', 'sex', 'age','update_time','status'])
->append(['extend'])
->order(['id' => 'desc'])
->select()
->toArray();

View File

@ -72,6 +72,7 @@ class InformationController extends BaseApiController
if ($res != true) {
return $this->fail( BaseLogic::getError());
}
UserInformationg::where('id',$param['id'])->update(['update_time'=>time()]);
return $this->success('成功');
}

View File

@ -237,6 +237,7 @@ class CompanyLogic extends BaseLogic
public static function Draftingcontracts($params)
{
$result = self::detail($params);
halt($result);
if ($result && $result['contract'] && $result['contract']['file'] != '') {
$data = [
'name' => $result['company_name'] . '合同',
@ -256,31 +257,43 @@ class CompanyLogic extends BaseLogic
return Db::name('dict_data')->where('id', $data['contract_type'])->value('name');
})->find();
if ($find) {
$data = array(
"applyNo" => $find['contract_no'], //TODO *
"fullName" => $company['company_name'], //TODO *
"identityCard" => $company['organization_code'], //TODO *
"identityType" => 12, //TODO *
);
$res = app(JunziqianController::class)->SigningLink($data);
if ($res->success == true) {
Db::name('contract')->where('id', $find['id'])->update(['url' => $res->data]);
//发送短信
$sms = [
'mobile' => $company['master_phone'],
'name' => $company['company_name'],
'type' => '《' . $find['contract_type_name'] . '》',
'code' => 'api/Hetong/url?id=' . $find['id'],
'scene' => 'WQ'
];
$result = SmsLogic::contractUrl($sms);
if (true === $result) {
return true;
$data = [
[
"applyNo" => $find['contract_no'], //TODO *
"fullName" => $result['contract']['party_a_info']['company_name'], //TODO *
"identityCard" => $result['contract']['party_a_info']['organization_code'], //TODO *
"identityType" => 12, //TODO *
"master_phone"=>$result['contract']['party_a_info']['master_phone']
],
[
"applyNo" => $find['contract_no'], //TODO *
"fullName" => $result['company_name'], //TODO *
"identityCard" => $result['organization_code'], //TODO *
"identityType" => 12, //TODO *
"master_phone"=>$result['master_phone']
]
];
foreach($data as $k=>$v){
$res = app(JunziqianController::class)->SigningLink($data);
if ($res->success == true ) {
Db::name('contract')->where('id', $find['id'])->update(['url' => $res->data]);
//发送短信
$sms = [
'mobile' => $v['master_phone'],
'name' => $v['company_name'],
'type' => '《' . $find['contract_type_name'] . '》',
'code' => 'api/Hetong/url?id=' . $find['id'],
'scene' => 'WQ'
];
$result = SmsLogic::contractUrl($sms);
if (true === $result) {
return true;
} else {
return self::setError(SmsLogic::getError());
}
} else {
return self::setError(SmsLogic::getError());
return self::setError($res->msg);
}
} else {
return self::setError($res->msg);
}
}
}
@ -296,29 +309,51 @@ class CompanyLogic extends BaseLogic
//**发送短信 */
public static function postsms($params)
{
$company = Db::name('company')->where('id', $params['id'])->find();
if ($company) {
$find = Db::name('contract')->where('party_b', $company['id'])
$result = self::detail($params);
if ($result && $result['contract'] && $result['contract']['file'] != '') {
//发送短信
$data = [
[
"applyNo" => $result['contract_no'], //TODO *
"fullName" => $result['contract']['party_a_info']['company_name'], //TODO *
"identityCard" => $result['contract']['party_a_info']['organization_code'], //TODO *
"identityType" => 12, //TODO *
"master_phone"=>$result['contract']['party_a_info']['master_phone']
],
[
"applyNo" => $result['contract_no'], //TODO *
"fullName" => $result['company_name'], //TODO *
"identityCard" => $result['organization_code'], //TODO *
"identityType" => 12, //TODO *
"master_phone"=>$result['master_phone']
]
];
$find = Db::name('contract')->where('party_b', $params['id'])
->withAttr('contract_type_name', function ($value, $data) {
return Db::name('dict_data')->where('id', $data['contract_type'])->value('name');
})
->find();
if ($find) {
//发送短信
$sms = [
'mobile' => $company['master_phone'],
'name' => $company['company_name'],
'type' => '《' . $find['contract_type_name'] . '》',
'code' => 'api/Hetong/url?id='.$find['id'],
'scene' => 'WQ'
];
$result = SmsLogic::contractUrl($sms);
if (true === $result) {
return true;
} else {
return self::setError(SmsLogic::getError());
})->find();
foreach($data as $k=>$v){
$res = app(JunziqianController::class)->SigningLink($data);
if ($res->success == true ) {
Db::name('contract')->where('id', $find['id'])->update(['url' => $res->data]);
//发送短信
$sms = [
'mobile' => $v['master_phone'],
'name' => $v['company_name'],
'type' => '《' . $find['contract_type_name'] . '》',
'code' => 'api/Hetong/url?id=' . $find['id'],
'scene' => 'WQ'
];
$result = SmsLogic::contractUrl($sms);
if (true === $result) {
return true;
} else {
return self::setError(SmsLogic::getError());
}
} else {
return self::setError($res->msg);
}
}
}
}
}
}

View File

@ -7,6 +7,7 @@ use think\facade\Db;
use think\facade\Log;
use app\common\logic\BaseLogic;
use app\common\model\Company;
use app\common\model\user\User;
class UserInformationg extends BaseModel
{
@ -22,6 +23,16 @@ class UserInformationg extends BaseModel
return $this->hasOne(\app\common\model\informationg\UserInformationgDemand::class, 'information_id', 'id');
}
public function getExtendAttr($valur,$data){
$company_name=Company::where('id',$data['company_id'])->value('company_name');
$nickname=User::where('id',$data['create_user_id'])->value('nickname');
return [
'company_name'=>$company_name,
'nickname'=>$nickname
];
}
public static function list($param, $page = 1, $size = 10)
{
return self::where($param)->with('company')