Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
朱继来
/
后台订单管理
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
44296154
authored
Jul 28, 2020
by
朱继来
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
设置样片过期接口
parent
f0275b78
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
44 additions
and
24 deletions
app/Http/Controllers/SpecialController.php
app/Http/routes.php
app/Model/UserSampleApplyModel.php
app/Model/UserSampleInviteModel.php
app/Http/Controllers/SpecialController.php
View file @
44296154
...
...
@@ -5,12 +5,15 @@ namespace App\Http\Controllers;
use
Illuminate\Http\Request
;
use
App\Http\Controllers\Controller
;
use
App\Model\UserMainModel
;
use
App\Model\UserInfoModel
;
use
App\Model\UserCompanyModel
;
use
App\Model\OrderModel
;
use
App\Model\OrderPriceModel
;
use
App\Model\OrderInvoiceModel
;
use
App\Model\OrderActionLogModel
;
use
App\Model\PayLogModel
;
use
App\Model\UserSampleApplyModel
;
use
App\Model\UserSampleInviteModel
;
use
DB
;
use
Excel
;
use
Log
;
...
...
@@ -318,4 +321,28 @@ class SpecialController extends Controller
return
'调整成功'
;
}
// 自营样片设置过期,剩余领取机会归零,不在领取表的用户默认1次领取机会
public
function
setSampleExpire
()
{
$UserInfoModel
=
new
UserInfoModel
;
$UserSampleApplyModel
=
new
UserSampleApplyModel
;
$UserSampleInviteModel
=
new
UserSampleInviteModel
;
$res
=
$UserSampleApplyModel
->
where
(
'is_expire'
,
1
)
->
update
([
'is_expire'
=>
-
1
]);
dump
(
$res
);
$res
=
$UserSampleInviteModel
->
where
(
'is_expire'
,
1
)
->
update
([
'is_expire'
=>
-
1
]);
dump
(
$res
);
$user_ids
=
$UserSampleApplyModel
->
where
(
'is_expire'
,
-
1
)
->
groupBy
(
'user_id'
)
->
lists
(
'user_id'
)
->
toArray
();
if
(
$user_ids
)
{
$res
=
$UserInfoModel
->
whereIn
(
'user_id'
,
$user_ids
)
->
update
([
'apply_count'
=>
0
]);
dump
(
$res
);
$res
=
$UserInfoModel
->
whereNotIn
(
'user_id'
,
$user_ids
)
->
where
(
'apply_count'
,
'>'
,
1
)
->
update
([
'apply_count'
=>
1
]);
dump
(
$res
);
}
}
}
\ No newline at end of file
app/Http/routes.php
View file @
44296154
...
...
@@ -42,10 +42,10 @@ Route::group(['middleware' => 'web'], function () {
Route
::
get
(
'/change/{id}'
,
'OrderController@changeOrder'
);
Route
::
match
([
'get'
,
'post'
],
'/sendSales/{id?}'
,
'OrderController@sendSales'
);
Route
::
post
(
'/ajaxdeletegoods'
,
'OrderController@ajaxdeletegoods'
);
Route
::
post
(
'/ajaxSaveChange'
,
'OrderController@ajaxSaveChange'
);
Route
::
post
(
'/ajaxApplyManagerAudit'
,
'OrderController@ajaxApplyManagerAudit'
);
Route
::
post
(
'/ajaxAuditPass'
,
'OrderController@ajaxAuditPass'
);
Route
::
post
(
'/ajaxReAudit'
,
'OrderController@ajaxReAudit'
);
Route
::
post
(
'/ajaxSaveChange'
,
'OrderController@ajaxSaveChange'
);
Route
::
post
(
'/ajaxApplyManagerAudit'
,
'OrderController@ajaxApplyManagerAudit'
);
Route
::
post
(
'/ajaxAuditPass'
,
'OrderController@ajaxAuditPass'
);
Route
::
post
(
'/ajaxReAudit'
,
'OrderController@ajaxReAudit'
);
Route
::
get
(
'/check/{id}'
,
'OrderController@check'
);
Route
::
match
([
'get'
,
'post'
],
'/applyAdjust/{id}'
,
'OrderController@applyAdjust'
);
Route
::
match
([
'get'
,
'post'
],
'/send/{id}'
,
'OrderController@send'
);
...
...
@@ -159,14 +159,15 @@ Route::group(['middleware' => 'api'], function () {
Route
::
get
(
'/api/check/sendsms'
,
'OrderController@checkOrderSendSms'
);
Route
::
get
(
'/api/check/cancelorder'
,
'OrderController@checkOrderCancel'
);
Route
::
get
(
'/api/check/histroyorder'
,
'OrderController@checkHistroyOrder'
);
Route
::
get
(
'/act/useramount'
,
'CronController@userAmount'
);
// 活动统计用户实付金额
Route
::
get
(
'/act/clear'
,
'CronController@clearData'
);
// 清除活动统计用户表和缓存
Route
::
get
(
'/act/sendactmsg'
,
'CronController@sendActMsg'
);
// 推送活动短信
Route
::
get
(
'/api/check/changeprice'
,
'SpecialController@changeOrderPrice'
);
Route
::
get
(
'/api/check/exportdimission'
,
'SpecialController@exportDimission'
);
Route
::
match
([
'get'
,
'post'
],
'/api/check/importdimission'
,
'SpecialController@importDimission'
);
Route
::
get
(
'/act/useramount'
,
'CronController@userAmount'
);
// 活动统计用户实付金额
Route
::
get
(
'/act/clear'
,
'CronController@clearData'
);
// 清除活动统计用户表和缓存
Route
::
get
(
'/handle/paylog'
,
'SpecialController@handlePayLog'
);
// 处理支付记录
Route
::
get
(
'/act/sendactmsg'
,
'CronController@sendActMsg'
);
// 推送活动短信
Route
::
get
(
'/handle/paytype'
,
'SpecialController@changeOrderPayType'
);
// 自营更改预付款支付方式
Route
::
get
(
'/handle/sample'
,
'SpecialController@setSampleExpire'
);
// 设置自营样片过期
Route
::
post
(
'/hprose/service'
,
function
(
Request
$request
)
{
$server
=
new
\App\Services\ExportService
();
...
...
app/Model/UserSampleApplyModel.php
View file @
44296154
...
...
@@ -13,6 +13,7 @@ class UserSampleApplyModel extends Model
protected
$primaryKey
=
'apply_id'
;
public
$timestamps
=
true
;
const
CREATED_AT
=
'create_time'
;
const
UPDATED_AT
=
null
;
/** * @param \DateTime|int $value * @return false|int * @author dividez */
public
function
fromDateTime
(
$value
)
...
...
@@ -99,8 +100,8 @@ class UserSampleApplyModel extends Model
$v
[
'work_function'
]
=
$UserInfoModel
->
getWorkFunction
(
$v
[
'user_id'
]);
$v
[
'invite_count'
]
=
$UserSampleInviteModel
->
getUserInviteCount
(
$v
[
'user_id'
]);
$v
[
'apply_num_total'
]
=
$this
->
getSampleApplySum
(
$v
[
'user_id'
]);
// 获取指定用户申请的样片总数
// $v['quota_total'] = $this->getSampleApplySum($v['user_id'], 'quota'); // 获取指定用户申请的样片总
数
$v
[
'quota_total'
]
=
$this
->
getUsedCount
(
$v
[
'user_id'
]);
// 获取指定用户申请的样片消耗总人数
$v
[
'quota_total'
]
=
$this
->
getSampleApplySum
(
$v
[
'user_id'
],
'quota'
);
// 获取指定用户申请的样片消耗总人
数
// $v['quota_total'] = $this->getUsedCount($v['user_id']); //
$v
[
'apply_count'
]
=
$UserInfoModel
->
getUserApplyCount
(
$v
[
'user_id'
]);
}
...
...
@@ -113,20 +114,9 @@ class UserSampleApplyModel extends Model
return
$this
->
from
(
'lie_user_sample_apply as s'
)
->
join
(
'lie_order as o'
,
's.order_id'
,
'='
,
'o.order_id'
)
->
where
(
's.user_id'
,
'='
,
$user_id
)
->
where
(
's.is_expire'
,
'='
,
1
)
->
where
(
'o.status'
,
'<>'
,
'-1'
)
->
sum
(
'apply_num'
);
// return $this->where('user_id', $user_id)->sum($field);
}
// 获取指定用户申请的样片消耗总人数
public
function
getUsedCount
(
$user_id
)
{
return
$this
->
from
(
'lie_user_sample_apply as s'
)
->
join
(
'lie_order as o'
,
's.order_id'
,
'='
,
'o.order_id'
)
->
where
(
's.user_id'
,
'='
,
$user_id
)
->
where
(
'o.status'
,
'<>'
,
'-1'
)
->
sum
(
'quota'
);
->
sum
(
$field
);
}
// 获取领取记录
...
...
@@ -160,7 +150,7 @@ class UserSampleApplyModel extends Model
$order
=
$OrderModel
->
where
(
'order_id'
,
$v
[
'order_id'
])
->
select
(
'status'
)
->
first
();
if
(
!
$order
)
continue
;
$v
[
'order_status'
]
=
Config
(
'params.order_status'
)[
$order
->
status
];
}
...
...
app/Model/UserSampleInviteModel.php
View file @
44296154
...
...
@@ -13,6 +13,7 @@ class UserSampleInviteModel extends Model
protected
$primaryKey
=
'invite_id'
;
public
$timestamps
=
true
;
const
CREATED_AT
=
'create_time'
;
const
UPDATED_AT
=
null
;
/** * @param \DateTime|int $value * @return false|int * @author dividez */
public
function
fromDateTime
(
$value
)
...
...
@@ -41,7 +42,7 @@ class UserSampleInviteModel extends Model
// 获取指定用户邀约人数
public
function
getUserInviteCount
(
$user_id
)
{
return
$this
->
where
(
'user_id'
,
$user_id
)
->
count
();
return
$this
->
where
(
'user_id'
,
$user_id
)
->
where
(
'is_expire'
,
1
)
->
count
();
}
// 获取用户邀约列表
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment