Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
M
my-yaf-project
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
chenchuanwen
my-yaf-project
Commits
acf382a6
Commit
acf382a6
authored
Aug 27, 2018
by
wwccw0591
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pc
parent
f9664330
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
78 additions
and
7 deletions
+78
-7
GoodsCommonStorage.php
application/models/DAO/Storage/GoodsCommonStorage.php
+41
-3
GoodsStorage.php
application/models/DAO/Storage/GoodsStorage.php
+35
-2
grow.php
scripts/crontab/growGoodsStores/grow.php
+2
-2
No files found.
application/models/DAO/Storage/GoodsCommonStorage.php
View file @
acf382a6
...
...
@@ -13,7 +13,7 @@ class GoodsCommonStorageModel extends \DAO\AbstractModel {
*
* @var string
*/
protected
$_tableName
=
'han_goods_common_storage
;
'
;
protected
$_tableName
=
'han_goods_common_storage'
;
/**
* 主键
...
...
@@ -63,13 +63,51 @@ class GoodsCommonStorageModel extends \DAO\AbstractModel {
}
public
function
getAll
(){
$this
->
setDb
(
$this
->
dbName
);
$res
=
$this
->
db
->
fetchAll
();
$res
=
$this
->
db
->
f
rom
(
$this
->
_tableName
)
->
f
etchAll
();
return
$res
;
}
public
function
createTestData
(){
$res
=
$this
->
getAll
();
echo
json_encode
(
$res
);
exit
;
$insertNames
=
array
();
$insertArray
=
array
();
$one
=
array
(
'状元笔记'
,
'三点一测'
,
'初高中'
,
'另类学习'
,
'天才辅导'
,
'启蒙'
,
'课外学习'
,
'小天才'
,
'深入理解'
,
'黄冈练习'
);
$two
=
array
(
'七年级'
,
'八年级'
,
'九年级'
);
$three
=
array
(
'语文'
,
'数学'
,
'英语'
,
'物理'
,
'化学'
,
'生物'
,
'地理'
,
'历史'
,
'政治'
);
$four
=
array
(
'人教版'
,
'北师大版'
,
'苏教版'
);
$five
=
array
(
'上册'
,
'下册'
);
$goodsStorage
=
\DAO\Storage\GoodsStorageModel
::
getInstance
();
foreach
(
$one
as
$onekey
=>
$oneVal
){
foreach
(
$two
as
$twoKey
=>
$twoVal
){
foreach
(
$three
as
$threeKey
=>
$threeVal
){
foreach
(
$four
as
$fourKey
=>
$fourVal
){
foreach
(
$five
as
$fiveKey
=>
$fiveVal
){
$diffKey
=
(
string
)
$onekey
.
(
string
)
$twoKey
.
(
string
)
$threeKey
.
(
string
)
$fourKey
.
(
string
)
$fiveKey
;
$catName
=
$oneVal
.
$twoVal
.
$threeVal
.
$fourVal
.
$fiveVal
;
$resultIndex
=
array_rand
(
$res
);
$re
=
$res
[
$resultIndex
];
$re
[
'goods_commonid'
]
=
500000
+
(
int
)
$diffKey
;
$re
[
'goods_name'
]
=
$catName
;
$re
[
'goods_jingle'
]
=
$catName
;
$re
[
'gc_name'
]
=
'学习辅导课程'
;
$re
[
'store_id'
]
=
117
;
$re
[
'store_name'
]
=
'文创园'
;
$re
[
'goods_addtime'
]
=
TIMESTAMP
;
$this
->
db
->
insert
(
$this
->
_tableName
)
->
rows
(
$re
)
->
execute
();
$goodsStorage
->
addOne
(
$re
);
}
}
}
}
}
}
/**
* 商品列表(需要获取销售价格)
* @param $where
...
...
application/models/DAO/Storage/GoodsStorage.php
View file @
acf382a6
...
...
@@ -94,8 +94,41 @@ class GoodsStorageModel extends \DAO\AbstractModel {
}
return
$goodsList
;
}
public
function
getAll
(){
$this
->
setDb
(
$this
->
dbName
);
$res
=
$this
->
db
->
from
(
$this
->
_tableName
)
->
fetchAll
();
return
$res
;
}
public
function
addOne
(
$res
){
$addData
[
'goods_id'
]
=
$res
[
'goods_commonid'
];
$addData
[
'goods_commonid'
]
=
$res
[
'goods_commonid'
];
$addData
[
'goods_name'
]
=
$res
[
'goods_name'
];
$addData
[
'goods_jingle'
]
=
$res
[
'goods_jingle'
];
$addData
[
'store_id'
]
=
$res
[
'store_id'
];
$addData
[
'store_name'
]
=
$res
[
'store_name'
];
$addData
[
'gc_id'
]
=
$res
[
'gc_id'
];
$addData
[
'gc_id_1'
]
=
$res
[
'gc_id_1'
];
$addData
[
'gc_id_2'
]
=
$res
[
'gc_id_2'
];
$addData
[
'gc_id_3'
]
=
$res
[
'gc_id_3'
];
$addData
[
'brand_id'
]
=
$res
[
'brand_id'
];
$addData
[
'goods_price'
]
=
$res
[
'goods_price'
];
$addData
[
'goods_marketprice'
]
=
$res
[
'goods_marketprice'
];
$addData
[
'goods_spec'
]
=
''
;
$addData
[
'goods_image'
]
=
$res
[
'goods_image'
];
$addData
[
'goods_state'
]
=
$res
[
'goods_state'
];
$addData
[
'goods_verify'
]
=
$res
[
'goods_verify'
];
$addData
[
'goods_addtime'
]
=
$res
[
'goods_addtime'
];
$addData
[
'goods_edittime'
]
=
$res
[
'goods_edittime'
];
$addData
[
'color_id'
]
=
0
;
$addData
[
'is_virtual'
]
=
$res
[
'is_virtual'
];
$addData
[
'virtual_indate'
]
=
$res
[
'virtual_indate'
];
$addData
[
'virtual_limit'
]
=
$res
[
'virtual_limit'
];
$addData
[
'virtual_invalid_refund'
]
=
$res
[
'virtual_invalid_refund'
];
$addData
[
'goods_youku_url'
]
=
$res
[
'goods_youku_url'
];
$addData
[
'goods_barcode'
]
=
$res
[
'goods_barcode'
];
$this
->
setDb
(
$this
->
dbName
);
$this
->
db
->
insert
(
$this
->
_tableName
)
->
rows
(
$addData
)
->
execute
();
}
public
function
validEditCartGoods
(
$where
,
$cart
,
$storageFlag
=
true
){
$goods
=
$this
->
getOnlineOne
(
$where
[
'goodsId'
]);
...
...
scripts/crontab/growGoodsStores/grow.php
View file @
acf382a6
...
...
@@ -51,7 +51,7 @@ class cliGrow extends basecli
echo
"*** Debug mode ***
\n
"
;
}
// Step: 02 检查是否已有相同CLI在运行中
$lockDir
=
$this
->
_getBaseFileName
(
'
shopkeeper
'
);
$lockDir
=
$this
->
_getBaseFileName
(
'
growGoodsStores
'
);
if
(
!
$this
->
mkdirs
(
$lockDir
))
{
echo
'****create dir fail ****'
;
exit
;
...
...
@@ -77,7 +77,7 @@ class cliGrow extends basecli
}
catch
(
Exception
$ex
)
{
throw
new
Exception
(
$ex
->
getCode
()
.
'|'
.
$ex
->
getMessage
());
}
echo
'店铺
订单索引
生成成功'
.
date
(
'Y-m-d H:i:s'
,
TIMESTAMP
)
.
"
\r\n
"
;
echo
'店铺生成成功'
.
date
(
'Y-m-d H:i:s'
,
TIMESTAMP
)
.
"
\r\n
"
;
}
}
...
...
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