Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
O
oa
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
朱招明
oa
Commits
59ee5b6f
Commit
59ee5b6f
authored
Nov 07, 2023
by
朱招明
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
5593ebc6
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
67 additions
and
17 deletions
+67
-17
AdminMenuTransformer.php
Modules/Admin/Http/Transformer/AdminMenuTransformer.php
+1
-1
BaseModel.php
Modules/Customers/Entities/BaseModel.php
+3
-1
Customer.php
Modules/Customers/Entities/Customer.php
+6
-0
CustomerFollow.php
Modules/Customers/Entities/CustomerFollow.php
+10
-0
BusinessOpportunityController.php
...tomers/Http/Controllers/BusinessOpportunityController.php
+5
-2
CustomersController.php
Modules/Customers/Http/Controllers/CustomersController.php
+17
-4
BusinessOpportunityRequest.php
...es/Customers/Http/Requests/BusinessOpportunityRequest.php
+2
-2
CustomerService.php
Modules/Customers/Http/Service/CustomerService.php
+7
-7
BusinessOpportunityTransformer.php
...omers/Http/Transformer/BusinessOpportunityTransformer.php
+6
-0
CustomerTransformer.php
Modules/Customers/Http/Transformer/CustomerTransformer.php
+6
-0
api.php
Modules/Customers/Routes/api.php
+4
-0
No files found.
Modules/Admin/Http/Transformer/AdminMenuTransformer.php
View file @
59ee5b6f
...
...
@@ -39,7 +39,7 @@ class AdminMenuTransformer extends BaseTransformer
public
function
transform
(
AdminMenu
$menu
)
{
$return
=
[
'id'
,
'parent_id'
,
'order'
,
'title'
,
'key'
,
'icon'
,
'is_menu'
,
'created_at'
];
$return
=
[
'id'
,
'parent_id'
,
'order'
,
'title'
,
'key'
,
'icon'
,
'
api'
,
'
is_menu'
,
'created_at'
];
return
Helper
::
mapAttr
(
$menu
,
$return
);
}
...
...
Modules/Customers/Entities/BaseModel.php
View file @
59ee5b6f
...
...
@@ -17,7 +17,9 @@ class BaseModel extends Model
public
function
scopeParamsSearch
(
$query
,
$params
)
{
foreach
(
$params
as
$key
=>
$value
){
$value
=
(
string
)
$value
;
if
(
$value
===
''
||
$value
===
NULL
){
continue
;
}
if
(
!
in_array
(
$key
,
$this
->
search
)){
continue
;
}
...
...
Modules/Customers/Entities/Customer.php
View file @
59ee5b6f
...
...
@@ -8,6 +8,8 @@
namespace
Modules\Customers\Entities
;
use
Illuminate\Database\Eloquent\Relations\HasMany
;
class
Customer
extends
BaseModel
{
protected
$fillable
=
[
...
...
@@ -80,4 +82,7 @@ class Customer extends BaseModel
$query
->
where
(
'owner'
,
0
);
}
public
function
follow
()
:
HasMany
{
return
$this
->
hasMany
(
CustomerFollow
::
class
)
->
orderByDesc
(
'follow_time'
);
}
}
\ No newline at end of file
Modules/Customers/Entities/CustomerFollow.php
View file @
59ee5b6f
...
...
@@ -29,4 +29,13 @@ class CustomerFollow extends BaseModel
6
=>
'未成交'
,
];
public
function
getStatusTextAttribute
()
{
return
static
::
$status_maps
[
$this
->
status
]
??
''
;
}
public
function
getTypeTextAttribute
()
{
return
static
::
$type_maps
[
$this
->
type
]
??
''
;
}
}
\ No newline at end of file
Modules/Customers/Http/Controllers/BusinessOpportunityController.php
View file @
59ee5b6f
...
...
@@ -25,8 +25,11 @@ class BusinessOpportunityController extends BaseController
* @modify
*/
public
function
list
(
BusinessOpportunityRequest
$request
){
$params
=
$request
->
input
(
'search'
,[]);
$params
=
$request
->
only
(
[
'expect_date'
,
'customer_name'
,
'customer_phone'
,
'title'
,
'id'
,
]
);
$list
=
BusinessOpportunity
::
paramsSearch
(
$params
)
->
paginate
(
request
(
'per_page'
));
return
$this
->
response
->
paginator
(
$list
,
new
BusinessOpportunityTransformer
());
...
...
Modules/Customers/Http/Controllers/CustomersController.php
View file @
59ee5b6f
...
...
@@ -9,6 +9,7 @@ use Modules\Customers\Entities\Customer;
use
Modules\Customers\Entities\CustomerFollow
;
use
Modules\Customers\Http\Requests\CustomerRequest
;
use
Modules\Customers\Http\Service\CustomerService
;
use
Modules\Customers\Http\Transformer\CustomerFollowTransformer
;
use
Modules\Customers\Http\Transformer\CustomerTransformer
;
class
CustomersController
extends
BaseController
...
...
@@ -24,9 +25,11 @@ class CustomersController extends BaseController
*/
public
function
list
(
CustomerRequest
$request
)
{
$params
=
$request
->
input
(
'search'
,[]);
$params
=
$request
->
only
([
'name'
,
'tel_phone'
,
'mobile_phone'
,
'wechat'
,
'follow_status'
,
'from'
,
'type'
,
'created_at'
,
]);
$list
=
Customer
::
{
$this
->
type
}()
->
paramsSearch
(
$params
)
->
paginate
(
request
(
'per_page'
));
$list
=
Customer
::
{
$this
->
type
}()
->
paramsSearch
(
$params
)
->
orderBy
(
'id'
,
'desc'
)
->
paginate
(
request
(
'per_page'
));
return
$this
->
response
->
paginator
(
$list
,
new
CustomerTransformer
());
...
...
@@ -45,7 +48,7 @@ class CustomersController extends BaseController
[
'name'
,
'company'
,
'industry'
,
'department'
,
'duties'
,
'tel_phone'
,
'mobile_phone'
,
'wechat'
,
'dy'
,
'email'
,
'province'
,
'city'
,
'area'
,
'address'
,
'follow_status'
,
'from'
,
'type'
,
'business_license'
,
'identity'
,
'bank_account'
,
'from'
,
'type'
,
]
);
...
...
@@ -115,7 +118,7 @@ class CustomersController extends BaseController
[
'name'
,
'company'
,
'industry'
,
'department'
,
'duties'
,
'tel_phone'
,
'mobile_phone'
,
'wechat'
,
'dy'
,
'email'
,
'province'
,
'city'
,
'area'
,
'address'
,
'follow_status'
,
'from'
,
'type'
,
'founder'
,
'owner'
,
'from'
,
'type'
,
]
);
$customer
=
Customer
::
where
(
'id'
,
$id
)
->
{
$this
->
type
}()
->
first
();
...
...
@@ -224,4 +227,14 @@ class CustomersController extends BaseController
];
return
$this
->
response
->
array
([
'data'
=>
$data
]);
}
public
function
followList
(
CustomerRequest
$request
,
$id
){
$customer
=
Customer
::
where
(
'id'
,
$id
)
->
{
$this
->
type
}()
->
first
();
if
(
!
$customer
)
{
abort
(
500
,
'客户不存在'
);
}
return
$this
->
response
->
collection
(
$customer
->
follow
,
new
CustomerFollowTransformer
());
}
}
Modules/Customers/Http/Requests/BusinessOpportunityRequest.php
View file @
59ee5b6f
...
...
@@ -17,7 +17,7 @@ class BusinessOpportunityRequest extends BaseRequest
'customer_id'
=>
'bail|required|exists:customers,id'
,
'product_type'
=>
[
'bail'
,
'required'
,
Rule
::
in
(
array_keys
(
BusinessOpportunity
::
$product_type_maps
))],
'title'
=>
'bail|required'
,
'demand_doc'
=>
'bail|required'
,
//
'demand_doc' => 'bail|required',
'customer_desire_time'
=>
[
'bail'
,
'required'
,
'date_format:Y-m-d H:i:s'
,
'after:now'
],
'customer_expect_money'
=>
'bail|required'
,
];
...
...
@@ -29,7 +29,7 @@ class BusinessOpportunityRequest extends BaseRequest
'customer_id'
=>
'bail|required|exists:customers,id'
,
'product_type'
=>
[
'bail'
,
'required'
,
Rule
::
in
(
array_keys
(
BusinessOpportunity
::
$product_type_maps
))],
'title'
=>
'bail|required'
,
'demand_doc'
=>
'bail|required'
,
//
'demand_doc' => 'bail|required',
'customer_desire_time'
=>
[
'bail'
,
'required'
,
'date_format:Y-m-d H:i:s'
,
'after:now'
],
'customer_expect_money'
=>
'bail|required'
,
];
...
...
Modules/Customers/Http/Service/CustomerService.php
View file @
59ee5b6f
...
...
@@ -86,7 +86,7 @@ class CustomerService
'wechat'
=>
''
,
'dy'
=>
''
,
'email'
=>
''
,
'address'
=>
'
0
'
,
'address'
=>
''
,
'follow_status'
=>
'0'
,
'from'
=>
'0'
,
'type'
=>
'0'
,
...
...
@@ -119,21 +119,21 @@ class CustomerService
}
#跟进状态
if
(
$field
==
'follow_status'
)
if
(
$field
==
'follow_status'
&&
empty
(
CustomerFollow
::
$status_maps
[
$value
])
)
{
$value
=
array_search
(
$value
,
CustomerFollow
::
$status_maps
)
?:
0
;
$value
=
0
;
}
#客户来源
if
(
$field
==
'from'
)
if
(
$field
==
'from'
&&
empty
(
Customer
::
$from_maps
[
$value
])
)
{
$value
=
array_search
(
$value
,
Customer
::
$from_maps
)
?:
0
;
$value
=
0
;
}
#客户类型
if
(
$field
==
'type'
)
if
(
$field
==
'type'
&&
empty
(
Customer
::
$type_maps
[
$value
])
)
{
$value
=
array_search
(
$value
,
Customer
::
$type_maps
)
?:
0
;
$value
=
0
;
}
$insert_item
[
$field
]
=
$value
;
...
...
Modules/Customers/Http/Transformer/BusinessOpportunityTransformer.php
View file @
59ee5b6f
...
...
@@ -13,6 +13,7 @@ use Modules\Customers\Entities\Customer;
class
BusinessOpportunityTransformer
extends
BaseTransformer
{
protected
array
$availableIncludes
=
[
'customer'
];
public
function
__construct
()
{
...
...
@@ -49,4 +50,9 @@ class BusinessOpportunityTransformer extends BaseTransformer
$return
=
Helper
::
mapAttr
(
$business_opportunity
,
$return
);
return
$return
;
}
public
function
includeCustomer
(
$business_opportunity
)
{
return
$business_opportunity
->
customer
?
$this
->
item
(
$business_opportunity
->
customer
,
new
CustomerTransformer
())
:
null
;
}
}
Modules/Customers/Http/Transformer/CustomerTransformer.php
View file @
59ee5b6f
...
...
@@ -12,6 +12,7 @@ use Modules\Customers\Entities\Customer;
class
CustomerTransformer
extends
BaseTransformer
{
protected
array
$availableIncludes
=
[
'follow'
];
public
function
__construct
()
{
...
...
@@ -60,4 +61,9 @@ class CustomerTransformer extends BaseTransformer
$return
=
Helper
::
mapAttr
(
$customer
,
$return
);
return
$return
;
}
public
function
includeFollow
(
$customer
)
{
return
$customer
->
follow
?
$this
->
collection
(
$customer
->
follow
,
new
CustomerFollowTransformer
())
:
null
;
}
}
Modules/Customers/Routes/api.php
View file @
59ee5b6f
...
...
@@ -34,6 +34,8 @@ $api->version('v1', [
$api
->
get
(
'private/{id}/show'
,
'PrivateCustomersController@show'
)
->
name
(
'customer.private.show'
);
#写跟进
$api
->
put
(
'private/{id}/follow'
,
'PrivateCustomersController@updateFollowStatus'
)
->
name
(
'customer.private.follow'
);
#跟进列表
$api
->
get
(
'private/{id}/follow_list'
,
'PrivateCustomersController@followList'
)
->
name
(
'customer.private.follow_list'
);
#退回公海
$api
->
put
(
'private/back_public'
,
'PrivateCustomersController@backPublic'
)
->
name
(
'customer.private.back_public'
);
#数据字段
...
...
@@ -54,6 +56,8 @@ $api->version('v1', [
$api
->
get
(
'public/{id}/show'
,
'PublicCustomersController@show'
)
->
name
(
'customer.public.show'
);
#写跟进
$api
->
put
(
'public/{id}/follow'
,
'PublicCustomersController@updateFollowStatus'
)
->
name
(
'customer.public.follow'
);
#跟进列表
$api
->
get
(
'public/{id}/follow_list'
,
'PublicCustomersController@followList'
)
->
name
(
'customer.public.follow_list'
);
#退回公海
$api
->
put
(
'public/receive_private'
,
'PublicCustomersController@receivePrivate'
)
->
name
(
'customer.public.receive_private'
);
#数据字段
...
...
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