Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
tl_estate
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
hujun
tl_estate
Commits
6b86d7e4
Commit
6b86d7e4
authored
Apr 06, 2018
by
clone
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
数据转换报备列表
parent
517ec678
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
250 additions
and
1 deletion
+250
-1
ConvertOrder.php
application/api/controller/ConvertOrder.php
+245
-0
Report.php
application/api_broker/controller/Report.php
+5
-1
No files found.
application/api/controller/ConvertOrder.php
0 → 100644
View file @
6b86d7e4
<?php
namespace
app\api\controller
;
use
app\api\extend\Basic
;
use
app\model\Applies
;
use
app\model\Users
;
use
think\Request
;
/**
* Created by PhpStorm.
* User : zw
* Date : 2018/4/2
* Time : 16:21
* Intro: 订单数据转换
*/
class
ConvertOrder
extends
Basic
{
private
$appliesModel
;
private
$userModel
;
public
function
__construct
(
$request
=
null
)
{
$this
->
appliesModel
=
new
Applies
();
$this
->
userModel
=
new
Users
();
parent
::
__construct
(
$request
);
}
public
function
convertOrderByTime
()
{
//todo old num convert new table. first select page report num.
//$params = $this->params;
$total
=
$this
->
appliesModel
->
getAppliesCount
();
$pageSize
=
200
;
$pageTotal
=
$total
/
$pageSize
;
$field
=
"a.id,a.phpone,a.agent_id,a.agent_shop_id,a.receptiontime ,a.house_id,a.customer,a.sex,a.vehicle,
b.title as house_title,b.room_num_left,c.phone,c.realname"
;
for
(
$pageNo
=
1
;
$pageNo
<=
$pageTotal
;
$pageNo
++
)
{
$appliesList
=
$this
->
appliesModel
->
getApplies
(
$pageNo
,
$pageSize
,
$field
);
if
(
count
(
$appliesList
)
>
0
)
{
$reportArr
=
[];
foreach
(
$appliesList
as
$item
)
{
$userInfo
=
$this
->
userModel
->
insertUserConvert
(
$this
->
userBin
(
$item
[
"customer"
],
$item
[
"customer"
],
$item
[
"phpone"
],
$item
[
"sex"
]));
if
(
count
(
$userInfo
)
<=
0
)
continue
;
$param
=
$this
->
reportBin
(
$item
[
"id"
],
$item
[
"agent_id"
],
$item
[
"phone"
],
$item
[
"realname"
],
$item
[
"agent_shop_id"
],
$userInfo
[
"id"
],
$userInfo
[
"user_phone"
]
,
$userInfo
[
"user_name"
],
$item
[
"vehicle"
],
$item
[
"agent_shop_id"
]);
array_push
(
$reportArr
,
$param
);
}
}
}
/* $house_arr = [];
foreach ($house_arr as $k => $v) {
//todo 批量插入到数据库
$order_no = $this->createOrderNumber();
array_push($order_arr, $this->orderBin($order_no, $id, $v));
}
//todo 保存order表
return $this->orderModel->insertOrderByAll($order_arr);*/
}
private
function
reportBin
(
$id
,
$report_agent_id
,
$report_agent_phone
,
$report_agent_name
,
$report_store_id
,
$user_id
,
$user_phone
,
$user_name
,
$vehicle
,
$intro
,
$predict_see_time
)
{
if
(
$vehicle
==
1
)
{
$vehicle
=
10
;
}
else
{
$vehicle
=
20
;
}
$param
[
"id"
]
=
$id
;
$param
[
"report_agent_id"
]
=
$report_agent_id
;
$param
[
"report_agent_phone"
]
=
$report_agent_phone
;
$param
[
"report_agent_name"
]
=
$report_agent_name
;
$param
[
"report_store_id"
]
=
$report_store_id
;
$param
[
"user_id"
]
=
$user_id
;
$param
[
"user_phone"
]
=
$user_phone
;
$param
[
"user_name"
]
=
$user_name
;
$param
[
"vehicle"
]
=
$vehicle
;
$param
[
"status"
]
=
0
;
$param
[
"intro"
]
=
$intro
;
$param
[
"predict_see_time"
]
=
date
(
"Y-m-d H:i:s"
,
$predict_see_time
);
$param
[
"create_time"
]
=
date
(
"Y-m-d H:i:s"
,
time
());
$param
[
"update_time"
]
=
date
(
"Y-m-d H:i:s"
,
time
());
return
$param
;
}
/**
* 订单号
* @return string
*/
private
function
createOrderNumber
()
{
return
time
()
.
mt_rand
(
100000
,
999999
);
}
/**
* 订单子表
* @param $order_no
* @param $f_id
* @param $house_id
* @return mixed
*/
private
function
orderBin
(
$order_no
,
$f_id
,
$house_id
)
{
$houseModel
=
new
GHouses
();
$houseResult
=
$houseModel
->
getHouseDetail
(
"id,internal_title"
,
[
"id"
=>
$house_id
]);
$house_title
=
count
(
$houseResult
)
>
0
&&
isset
(
$houseResult
[
"internal_title"
])
?
$houseResult
[
"internal_title"
]
:
null
;
$param
[
"order_no"
]
=
$order_no
;
$param
[
"f_id"
]
=
$f_id
;
$param
[
"house_id"
]
=
$house_id
;
$param
[
"house_title"
]
=
$house_title
;
$param
[
"create_time"
]
=
date
(
"Y-m-d H:i:s"
,
time
());
$param
[
"update_time"
]
=
date
(
"Y-m-d H:i:s"
,
time
());
return
$param
;
}
//成交报告
private
function
bargainBin
(
$father_id
,
$commission_val
,
$submit_agent_id
,
$report_id
,
$order_id
,
$order_no
,
$trade_type
,
$price
,
$commission
)
{
$arr
[
"report_id"
]
=
$report_id
;
$arr
[
"father_id"
]
=
$father_id
;
$arr
[
"order_no"
]
=
$order_no
;
$arr
[
"order_id"
]
=
$order_id
;
$arr
[
"submit_agent_id"
]
=
$submit_agent_id
;
$arr
[
"trade_type"
]
=
$trade_type
;
$arr
[
"price"
]
=
$price
;
$arr
[
"commission"
]
=
$commission
;
$arr
[
"role"
]
=
$commission_val
[
"role"
];
$arr
[
"agent_id"
]
=
$commission_val
[
"agent_id"
];
$arr
[
"scale"
]
=
$commission_val
[
"scale"
];
$arr
[
"scale_fee"
]
=
$commission_val
[
"scale_fee"
];
$arr
[
"create_time"
]
=
date
(
"Y-m-d H:i:s"
,
time
());
$arr
[
"update_time"
]
=
date
(
"Y-m-d H:i:s"
,
time
());
return
$arr
;
}
//跟进
private
function
followUpBin
()
{
$params
=
array
(
"report_id"
=>
1
,
"agent_id"
=>
12
,
"user_type"
=>
"1,2"
,
// 用户类型
"decision_maker"
=>
"zhangsan"
,
// 第一决策人
"industry_type"
=>
"1,2"
,
//租商铺做什么
"area_requirement"
=>
"1,2"
,
//面积要求
"price_requirement"
=>
"1,2"
,
//价格要求
"province"
=>
"1,2"
,
//省
"city"
=>
"1,2"
,
//市
"district"
=>
"1,2"
,
//区
"business_area"
=>
"1,2"
,
//商圈
"other_area"
=>
"1,2"
,
//其他地区
"explain"
=>
"1,2"
,
//备注
"explain_img"
=>
"1,2"
//备注图
);
$is_ok
=
$this
->
fulModel
->
addFollowUpLog
(
$params
);
}
//收款
private
function
collectingBillBin
(
$father_id
,
$collecting_arr
,
$agent_id
,
$report_id
,
$order_id
,
$order_no
,
$house_number
,
$industry_type
,
$remark
,
$transfer_img
)
{
$arr
[
"report_id"
]
=
$report_id
;
$arr
[
"father_id"
]
=
$father_id
;
$arr
[
"order_no"
]
=
$order_no
;
$arr
[
"order_id"
]
=
$order_id
;
$arr
[
"agent_id"
]
=
$agent_id
;
$arr
[
"type"
]
=
$collecting_arr
[
"type"
];
$arr
[
"pay_type"
]
=
$collecting_arr
[
"pay_type"
];
$arr
[
"money"
]
=
$collecting_arr
[
"money"
];
$arr
[
"house_number"
]
=
$house_number
;
$arr
[
"industry_type"
]
=
$industry_type
;
$arr
[
"remark"
]
=
$remark
;
$arr
[
"transfer_img"
]
=
$transfer_img
;
$arr
[
"create_time"
]
=
date
(
"Y-m-d H:i:s"
,
time
());
$arr
[
"update_time"
]
=
date
(
"Y-m-d H:i:s"
,
time
());
return
$arr
;
}
//退款
private
function
refundBin
()
{
$params
=
array
(
"agent_id"
=>
1
,
//退款经纪人id
"report_id"
=>
1
,
//报备id
"order_id"
=>
1
,
//关联order表id
"order_no"
=>
"12312312312312"
,
//订单no
"refund_money"
=>
1200
,
//退款金额 存分
"name"
=>
"qweqwe"
,
//收款人姓名
"bank"
=>
"asdasdasd"
,
//收款人银行
"card_no"
=>
"123123123123"
,
//银行卡号
"remark"
=>
"没什么备注"
,
"remark_img"
=>
"12312312312"
);
//todo 判断此单是否有付款
$is_ok
=
$this
->
o_refund_model
->
addRefund
(
$params
);
}
private
function
marchInBin
()
{
$params
=
array
(
"reception_id"
=>
1
,
//带看经纪人id
"report_id"
=>
1
,
//报备id
"order_id"
=>
1
,
//关联order表id
"order_no"
=>
"123123123123123"
,
//订单no
"march_in_remark"
=>
"有意向购买"
,
//进场备注
"march_in_img"
=>
"123123"
,
//备注图片
"march_in_area"
=>
"上海市虹口区中山公园"
,
//进场地址
);
// $params["reception_id"] = $this->agentName;
$is_ok
=
$this
->
o_march_in_model
->
addMarchIn
(
$params
);
}
private
function
userBin
(
$user_nick
,
$user_name
,
$user_phone
,
$sex
)
{
if
(
$sex
==
"男"
)
{
$sex
=
1
;
}
elseif
(
$sex
==
"女"
)
{
$sex
=
2
;
}
else
{
$sex
=
0
;
}
$param
[
"user_nick"
]
=
$user_nick
;
$param
[
"user_name"
]
=
$user_name
;
$param
[
"user_phone"
]
=
$user_phone
;
$param
[
"sex"
]
=
$sex
;
$param
[
"status"
]
=
-
1
;
$param
[
"source"
]
=
30
;
//老数据转换
$param
[
"create_time"
]
=
date
(
"Y-m-d H:i:s"
,
time
());
$param
[
"update_time"
]
=
date
(
"Y-m-d H:i:s"
,
time
());
return
$param
;
}
}
application/api_broker/controller/Report.php
View file @
6b86d7e4
...
...
@@ -103,8 +103,12 @@ class Report extends Basic
$result
=
$this
->
service_
->
orderList
(
$field
,
$params
,
$pageNo
,
$pageSize
);
if
(
count
(
$result
)
>
0
)
{
return
$this
->
response
(
"200"
,
"request success"
,
$result
);
}
else
{
return
$this
->
response
(
"200"
,
"request null"
);
}
return
$this
->
response
(
"200"
,
"request success"
,
$result
);
}
...
...
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