Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
goods
Project
Project
Details
Activity
Releases
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
bp
goods
Commits
49b895ce
Commit
49b895ce
authored
Jul 06, 2021
by
luhongguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update:lastid调整
parent
11196bee
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
107 additions
and
1 deletion
+107
-1
QyqTicketData.php
application/models/tmp/mysql/QyqTicketData.php
+24
-0
GoodsToInit.php
application/modules/Cli/controllers/GoodsToInit.php
+82
-0
GoodsService.php
application/services/goods/GoodsService.php
+1
-1
No files found.
application/models/tmp/mysql/QyqTicketData.php
0 → 100644
View file @
49b895ce
<?php
namespace
App\Models\tmp\mysql
;
use
Api\PhpUtils\Mysql\MysqlBase
;
/**
* Class QyqTicketData
* 老商品数据,跑数据用
* @package App\Models\goods\mysql
*/
class
QyqTicketData
extends
MysqlBase
{
const
TABLE_NAME
=
'qyq_ticketdata'
;
const
CONFIG_INDEX
=
'goods'
;
public
static
function
getRecordList
(
$where
=
[],
$columns
=
[])
{
if
(
empty
(
$columns
))
{
$columns
=
'*'
;
}
return
self
::
select
(
$columns
,
$where
);
}
}
\ No newline at end of file
application/modules/Cli/controllers/GoodsToInit.php
0 → 100644
View file @
49b895ce
<?php
use
Api\PhpUtils\Http\Request
;
use
App\Base\Cli
;
use
App\Exception\custom\InterfaceException
;
use
\App\Models\tmp\mysql\QyqTicketData
;
/**
* 导入老商品数据
* php public/cli.php GoodsToInit run
* Class GoodsToInitController
*/
class
GoodsToInitController
extends
Cli
{
public
function
runAction
()
{
$total
=
$this
->
getDataCount
();
$pageSize
=
10
;
$pageTotal
=
floor
(
$total
/
$pageSize
)
+
1
;
for
(
$i
=
0
;
$i
<=
$pageTotal
;
$i
++
)
{
echo
$i
.
"
\n
"
;
$list
=
$this
->
getDataList
(
$i
,
$pageSize
);
foreach
(
$list
as
$item
)
{
$lifeAccountId
=
$item
[
"life_account_id"
];
$merchantId
=
$this
->
getMerchantId
(
$lifeAccountId
);
if
(
empty
(
$merchantId
))
{
echo
"生活号 "
.
$lifeAccountId
.
" 没有对应的 merchant_id
\n
"
;
continue
;
}
}
}
}
/**
* 总数
* @return \Api\PhpUtils\Mysql\MysqlBase
*/
private
function
getDataCount
()
{
return
QyqTicketData
::
count
([]);
}
/**
* 每页取指定条数数据处理
* @param $page
* @param $limit
* @return \Api\PhpUtils\Mysql\MysqlBase
*/
private
function
getDataList
(
$page
,
$limit
)
{
$from
=
$page
*
$limit
;
$where
[
"LIMIT"
]
=
[
$from
,
$limit
];
return
QyqTicketData
::
select
(
"*"
,
$where
);
}
/**
* 脚本第一步,把所有的
*/
private
function
dealShopData
()
{
}
/**
* 获取 merchant_id
* @param $lifeAccountId
* @return mixed|string
* @throws InterfaceException
*/
private
function
getMerchantId
(
$lifeAccountId
)
{
$url
=
config
(
'interface'
,
'merchant.lifeaccount.get_life_account_by_id'
);
if
(
empty
(
$url
))
{
throw
new
InterfaceException
([
'cus'
=>
0
]);
}
$lifeAccountRes
=
(
new
Request
())
->
get
(
$url
,
[
"life_account_id"
=>
$lifeAccountId
]);
return
empty
(
$lifeAccountRes
[
"response"
][
"result"
][
"merchant_id"
])
?
""
:
$lifeAccountRes
[
"response"
][
"result"
][
"merchant_id"
];
}
}
\ No newline at end of file
application/services/goods/GoodsService.php
View file @
49b895ce
...
...
@@ -935,7 +935,7 @@ class GoodsService
$lastId
=
$sku
[
"goods_spu_id"
];
}
}
else
{
$lastId
=
-
1
;
$lastId
=
"-1"
;
}
return
[
"status_list"
=>
$statusList
,
"goods_list"
=>
$data
,
"last_id"
=>
$lastId
];
...
...
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