更新api接口
This commit is contained in:
parent
627e690ead
commit
fa95a753cb
@ -107,6 +107,9 @@ class UserController extends BaseAdminController
|
|||||||
$params = Request::param();
|
$params = Request::param();
|
||||||
$result = UserLogic::detail($params['id']);
|
$result = UserLogic::detail($params['id']);
|
||||||
if ($result && $result['contract'] && $result['contract']['file'] != '') {
|
if ($result && $result['contract'] && $result['contract']['file'] != '') {
|
||||||
|
if($result['contract']['check_status']==3){
|
||||||
|
return $this->fail('你已经生成过合同,请问重复生成');
|
||||||
|
}
|
||||||
$data = [
|
$data = [
|
||||||
'name' => $result['nickname'] . '的合同',
|
'name' => $result['nickname'] . '的合同',
|
||||||
'signatories' => [['fullName' => $result['nickname'], 'identityType' => 1, 'identityCard' => $result['id_card'], 'mobile' => $result['mobile'], 'noNeedVerify' => 1, 'signLevel' => 1]],
|
'signatories' => [['fullName' => $result['nickname'], 'identityType' => 1, 'identityCard' => $result['id_card'], 'mobile' => $result['mobile'], 'noNeedVerify' => 1, 'signLevel' => 1]],
|
||||||
@ -114,7 +117,7 @@ class UserController extends BaseAdminController
|
|||||||
];
|
];
|
||||||
$res = app(JunziqianController::class)->Signing($data,$result['contract']['id']);
|
$res = app(JunziqianController::class)->Signing($data,$result['contract']['id']);
|
||||||
if ($res->success == true) {
|
if ($res->success == true) {
|
||||||
Db::name('contract')->where('id', $result['contract']['id'])->update(['contract_no' => $res->data]);
|
Db::name('contract')->where('id', $result['contract']['id'])->update(['contract_no' => $res->data,'check_status'=>3]);
|
||||||
$data = array(
|
$data = array(
|
||||||
"applyNo" => $res->data, //TODO *
|
"applyNo" => $res->data, //TODO *
|
||||||
"fullName" => $result['nickname'], //TODO *
|
"fullName" => $result['nickname'], //TODO *
|
||||||
|
@ -35,7 +35,7 @@ class AccountLogController extends BaseApiController
|
|||||||
return $this->dataLists(new AccountLogLists());
|
return $this->dataLists(new AccountLogLists());
|
||||||
}
|
}
|
||||||
|
|
||||||
//月份统计
|
//个人月份统计
|
||||||
public function year_count()
|
public function year_count()
|
||||||
{
|
{
|
||||||
$data = [['month'=>date('Y').'-01'],['month'=>date('Y').'-02'],['month'=>date('Y').'-03'],['month'=>date('Y').'-04'],['month'=>date('Y').'-05'],['month'=>date('Y').'-06'],['month'=>date('Y').'-07'],['month'=>date('Y').'-08'],['month'=>date('Y').'-09'],['month'=>date('Y').'-10'],['month'=>date('Y').'-11'],['month'=>date('Y').'-12']];
|
$data = [['month'=>date('Y').'-01'],['month'=>date('Y').'-02'],['month'=>date('Y').'-03'],['month'=>date('Y').'-04'],['month'=>date('Y').'-05'],['month'=>date('Y').'-06'],['month'=>date('Y').'-07'],['month'=>date('Y').'-08'],['month'=>date('Y').'-09'],['month'=>date('Y').'-10'],['month'=>date('Y').'-11'],['month'=>date('Y').'-12']];
|
||||||
@ -78,4 +78,13 @@ class AccountLogController extends BaseApiController
|
|||||||
}
|
}
|
||||||
return $this->success('ok',array_reverse($data));
|
return $this->success('ok',array_reverse($data));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//公司日流水统计
|
||||||
|
public function company_lists(){
|
||||||
|
return $this->dataLists(new AccountLogLists(),'company_lists');
|
||||||
|
}
|
||||||
|
//公司月流水统计
|
||||||
|
public function company_year_count(){
|
||||||
|
return $this->dataLists(new AccountLogLists(),'company_year_count');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,7 @@ use app\common\model\auth\SystemRole;
|
|||||||
use app\common\model\Company;
|
use app\common\model\Company;
|
||||||
use app\common\model\contract\Contract;
|
use app\common\model\contract\Contract;
|
||||||
use app\common\model\user\User;
|
use app\common\model\user\User;
|
||||||
|
use app\common\model\user\UserAccountLog;
|
||||||
use think\facade\Db;
|
use think\facade\Db;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -17,6 +18,7 @@ use think\facade\Db;
|
|||||||
class CompanyController extends BaseApiController
|
class CompanyController extends BaseApiController
|
||||||
{
|
{
|
||||||
|
|
||||||
|
//**签约公司*/
|
||||||
public function index()
|
public function index()
|
||||||
{
|
{
|
||||||
[$page, $limit] = $this->getPage();
|
[$page, $limit] = $this->getPage();
|
||||||
@ -32,6 +34,18 @@ class CompanyController extends BaseApiController
|
|||||||
return $this->success('', ['count' => $count, 'data' => $companies]);
|
return $this->success('', ['count' => $count, 'data' => $companies]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 未签约
|
||||||
|
*/
|
||||||
|
public function unsigned()
|
||||||
|
{
|
||||||
|
$myCompany = Company::findOrEmpty($this->userInfo['company_id'])->toArray();
|
||||||
|
$query = Company::where(['street' => $myCompany['street'], 'company_type' => [17, 18]]);
|
||||||
|
$count = $query->count();
|
||||||
|
$companies = $query->select()->toArray();
|
||||||
|
return $this->success('', ['count' => $count, 'data' => $companies]);
|
||||||
|
}
|
||||||
|
|
||||||
public function view()
|
public function view()
|
||||||
{
|
{
|
||||||
$id = $this->request->param('id', 0);
|
$id = $this->request->param('id', 0);
|
||||||
@ -40,7 +54,7 @@ class CompanyController extends BaseApiController
|
|||||||
} else {
|
} else {
|
||||||
$query = Company::find($id);
|
$query = Company::find($id);
|
||||||
}
|
}
|
||||||
if(!$query){
|
if (!$query) {
|
||||||
return $this->fail('公司不存在');
|
return $this->fail('公司不存在');
|
||||||
}
|
}
|
||||||
$company = $query->append(['province_name', 'city_name', 'area_name', 'street_name', 'area_manager_name'])->toArray();
|
$company = $query->append(['province_name', 'city_name', 'area_name', 'street_name', 'area_manager_name'])->toArray();
|
||||||
@ -58,6 +72,7 @@ class CompanyController extends BaseApiController
|
|||||||
$contract['contract_type_name'] = Db::name('dict_data')->where('id', $contract['contract_type'])->value('name');
|
$contract['contract_type_name'] = Db::name('dict_data')->where('id', $contract['contract_type'])->value('name');
|
||||||
}
|
}
|
||||||
$company['company_type_name'] = Db::name('dict_data')->where('id', $company['company_type'])->value('name');
|
$company['company_type_name'] = Db::name('dict_data')->where('id', $company['company_type'])->value('name');
|
||||||
|
$company['day_money_count']=UserAccountLog::where(['company_id'=>$company['id'],'action'=>1])->whereDay('create_time')->sum('change_amount');
|
||||||
$users = Admin::where('company_id', $company['id'])->field('id,name,account,phone,qualification')->select()->toArray();
|
$users = Admin::where('company_id', $company['id'])->field('id,name,account,phone,qualification')->select()->toArray();
|
||||||
foreach ($users as &$user) {
|
foreach ($users as &$user) {
|
||||||
$user['is_main'] = $user['id'] == $company['admin_id'] ? 1 : 0;
|
$user['is_main'] = $user['id'] == $company['admin_id'] ? 1 : 0;
|
||||||
@ -88,9 +103,9 @@ class CompanyController extends BaseApiController
|
|||||||
$count = $query->count();
|
$count = $query->count();
|
||||||
$users = $query->page($page)->limit($limit)->with(['company' => function ($query) {
|
$users = $query->page($page)->limit($limit)->with(['company' => function ($query) {
|
||||||
$query->field('id,company_name');
|
$query->field('id,company_name');
|
||||||
}])->append(['province_name', 'city_name', 'area_name', 'street_name'])->field('id,avatar,real_name,account,mobile as phone,province,city,area,street,company_id,qualification,nickname,is_contract,is_captain')->select()->each(function($item,$key){
|
}])->append(['province_name', 'city_name', 'area_name', 'street_name'])->field('id,avatar,real_name,account,mobile as phone,province,city,area,street,company_id,qualification,nickname,is_contract,is_captain')->select()->each(function ($item, $key) {
|
||||||
if($item['qualification']!=''){
|
if ($item['qualification'] != '') {
|
||||||
$item['qualification']=json_decode($item['qualification'],true);
|
$item['qualification'] = json_decode($item['qualification'], true);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return $this->success('success', ['count' => $count, 'data' => $users]);
|
return $this->success('success', ['count' => $count, 'data' => $users]);
|
||||||
@ -110,5 +125,4 @@ class CompanyController extends BaseApiController
|
|||||||
unset($user['role_id'], $user['dept_id'], $user['jobs_id']);
|
unset($user['role_id'], $user['dept_id'], $user['jobs_id']);
|
||||||
return $this->success('success', $user);
|
return $this->success('success', $user);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
|
||||||
|
@ -96,4 +96,82 @@ class AccountLogLists extends BaseApiDataLists
|
|||||||
{
|
{
|
||||||
return UserAccountLog::where($this->queryWhere())->count();
|
return UserAccountLog::where($this->queryWhere())->count();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 公司日流水统计
|
||||||
|
*/
|
||||||
|
public function company_lists(): array
|
||||||
|
{
|
||||||
|
$field = 'change_type,change_amount,action,create_time,remark';
|
||||||
|
$where=[
|
||||||
|
'company_id'=>$this->params['company_id']
|
||||||
|
];
|
||||||
|
$lists = UserAccountLog::field($field)
|
||||||
|
->where($where)
|
||||||
|
->whereDay('create_time')
|
||||||
|
->order('id', 'desc')
|
||||||
|
->limit($this->limitOffset, $this->limitLength)
|
||||||
|
->select()
|
||||||
|
->toArray();
|
||||||
|
|
||||||
|
foreach ($lists as &$item) {
|
||||||
|
$item['type_desc'] = AccountLogEnum::getChangeTypeDesc($item['change_type']);
|
||||||
|
$symbol = $item['action'] == AccountLogEnum::DEC ? '-' : '+';
|
||||||
|
$item['change_amount_desc'] = $symbol . $item['change_amount'];
|
||||||
|
}
|
||||||
|
|
||||||
|
return $lists;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 公司月流水统计
|
||||||
|
*/
|
||||||
|
public function company_year_count()
|
||||||
|
{
|
||||||
|
$where=[
|
||||||
|
'company_id'=>$this->params['company_id'],
|
||||||
|
'action'=>1,
|
||||||
|
];
|
||||||
|
$where2=[
|
||||||
|
'company_id'=>$this->params['company_id'],
|
||||||
|
'action'=>2,
|
||||||
|
];
|
||||||
|
$data = [['month'=>date('Y').'-01'],['month'=>date('Y').'-02'],['month'=>date('Y').'-03'],['month'=>date('Y').'-04'],['month'=>date('Y').'-05'],['month'=>date('Y').'-06'],['month'=>date('Y').'-07'],['month'=>date('Y').'-08'],['month'=>date('Y').'-09'],['month'=>date('Y').'-10'],['month'=>date('Y').'-11'],['month'=>date('Y').'-12']];
|
||||||
|
$year = date('Y');
|
||||||
|
$change_amount_1 = UserAccountLog::whereYear('create_time', $year)
|
||||||
|
->where($where)
|
||||||
|
->field('DATE_FORMAT(FROM_UNIXTIME(create_time), "%Y-%m") as month, SUM(change_amount) as total')
|
||||||
|
->group('month')
|
||||||
|
->order('month')
|
||||||
|
->select();
|
||||||
|
$change_amount_2 = UserAccountLog::whereYear('create_time', $year)
|
||||||
|
->where($where2)
|
||||||
|
->field('DATE_FORMAT(FROM_UNIXTIME(create_time), "%Y-%m") as month, SUM(change_amount) as total')
|
||||||
|
->group('month')
|
||||||
|
->order('month')
|
||||||
|
->select();
|
||||||
|
foreach($data as $k=>$v){
|
||||||
|
foreach($change_amount_1 as $key=>$val){
|
||||||
|
if($v['month'] == $val['month']){
|
||||||
|
$data[$k]['income'] = $val['total'];
|
||||||
|
if(!isset($data[$k]['expenditure'])){
|
||||||
|
$data[$k]['expenditure'] = 0;
|
||||||
|
}
|
||||||
|
$data[$k]['income'] = $val['total'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
foreach($change_amount_2 as $key=>$val){
|
||||||
|
if($v['month'] == $val['month']){
|
||||||
|
$data[$k]['expenditure'] = $val['total'];
|
||||||
|
if(!isset($data[$k]['income'])){
|
||||||
|
$data[$k]['income'] = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(!isset($data[$k]['income'])||!isset($data[$k]['expenditure'])){
|
||||||
|
unset($data[$k]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return array_reverse($data);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,6 +18,7 @@ use app\common\cache\WebScanLoginCache;
|
|||||||
use app\common\logic\BaseLogic;
|
use app\common\logic\BaseLogic;
|
||||||
use app\api\service\{UserTokenService, WechatUserService};
|
use app\api\service\{UserTokenService, WechatUserService};
|
||||||
use app\common\enum\{LoginEnum, user\UserTerminalEnum, YesNoEnum};
|
use app\common\enum\{LoginEnum, user\UserTerminalEnum, YesNoEnum};
|
||||||
|
use app\common\model\dict\DictData;
|
||||||
use app\common\service\{
|
use app\common\service\{
|
||||||
ConfigService,
|
ConfigService,
|
||||||
FileService,
|
FileService,
|
||||||
@ -47,6 +48,12 @@ class LoginLogic extends BaseLogic
|
|||||||
public static function register(array $params)
|
public static function register(array $params)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
|
$count=User::where('company_id',$params['company_id'])->count();
|
||||||
|
$value=DictData::where('id',28)->value('value');
|
||||||
|
if($count>=$value){
|
||||||
|
self::setError('你创建的账号已达上限');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
$userSn = User::createUserSn();
|
$userSn = User::createUserSn();
|
||||||
$passwordSalt = Config::get('project.unique_identification');
|
$passwordSalt = Config::get('project.unique_identification');
|
||||||
$password = create_password($params['password'], $passwordSalt);
|
$password = create_password($params['password'], $passwordSalt);
|
||||||
|
@ -24,6 +24,7 @@ use app\common\{enum\notice\NoticeEnum,
|
|||||||
service\sms\SmsDriver,
|
service\sms\SmsDriver,
|
||||||
service\wechat\WeChatMnpService
|
service\wechat\WeChatMnpService
|
||||||
};
|
};
|
||||||
|
use app\common\model\user\UserAccountLog;
|
||||||
use think\db\exception\DataNotFoundException;
|
use think\db\exception\DataNotFoundException;
|
||||||
use think\exception\ValidateException;
|
use think\exception\ValidateException;
|
||||||
use think\facade\Config;
|
use think\facade\Config;
|
||||||
@ -77,6 +78,7 @@ class UserLogic extends BaseLogic
|
|||||||
->field('id,sn,sex,account,password,nickname,real_name,avatar,mobile,create_time,user_money,income,admin_id,company_id,is_captain')
|
->field('id,sn,sex,account,password,nickname,real_name,avatar,mobile,create_time,user_money,income,admin_id,company_id,is_captain')
|
||||||
->findOrEmpty();
|
->findOrEmpty();
|
||||||
// $user['avatar'] = $user['avatar'] ? Request()->host() . $user['avatar'] : $user['avatar'];
|
// $user['avatar'] = $user['avatar'] ? Request()->host() . $user['avatar'] : $user['avatar'];
|
||||||
|
$user['day_money_count']=UserAccountLog::where(['user_id'=>$userId,'action'=>1])->whereDay('create_time')->sum('change_amount');
|
||||||
$user['has_password'] = !empty($user['password']);
|
$user['has_password'] = !empty($user['password']);
|
||||||
$user['has_auth'] = self::hasWechatAuth($userId);
|
$user['has_auth'] = self::hasWechatAuth($userId);
|
||||||
$user['version'] = config('project.version');
|
$user['version'] = config('project.version');
|
||||||
|
@ -143,6 +143,9 @@ class UserLogic extends BaseLogic
|
|||||||
|
|
||||||
$result = self::detail($params['id']);
|
$result = self::detail($params['id']);
|
||||||
if ($result && $result['contract'] && $result['contract']['file'] != '') {
|
if ($result && $result['contract'] && $result['contract']['file'] != '') {
|
||||||
|
if($result['contract']['check_status']==3){
|
||||||
|
return self::setError('你已经生成过合同,请问重复生成');
|
||||||
|
}
|
||||||
$data = [
|
$data = [
|
||||||
'name' => $result['nickname'] . '的合同',
|
'name' => $result['nickname'] . '的合同',
|
||||||
'signatories' => [['fullName' => $result['nickname'], 'identityType' => 1, 'identityCard' => $result['id_card'], 'mobile' => $result['mobile'], 'noNeedVerify' => 1, 'signLevel' => 1]],
|
'signatories' => [['fullName' => $result['nickname'], 'identityType' => 1, 'identityCard' => $result['id_card'], 'mobile' => $result['mobile'], 'noNeedVerify' => 1, 'signLevel' => 1]],
|
||||||
|
2
vendor/ebaoquan/junziqian_sdk
vendored
2
vendor/ebaoquan/junziqian_sdk
vendored
@ -1 +1 @@
|
|||||||
Subproject commit 9acc82cd23d807280ddd29df2117e7890094d049
|
Subproject commit 1294ea49ff9ecc4532821f8798304816cbf8dd74
|
Loading…
x
Reference in New Issue
Block a user