123456789101112131415161718192021222324252627282930 |
- <?php
- namespace Code\Lib;
- use Dever;
- class Core
- {
- public function createCode($product, $cate_id, $product_id, $seller_id, $product_num = 1, $create_uid = -1)
- {
- $code = Dever::rand(8, 0);
- $data['code'] = $code;
- $total = Dever::db('code/info')->total($data);
- if ($total > 0) {
- return $this->createCode($product, $cate_id, $product_id, $seller_id, $product_num, $create_uid);
- }
-
- //$data['product'] = $product;
- $data['cate_id'] = $cate_id;
- $data['product_id'] = $product_id;
- $data['seller_id'] = $seller_id;
- $data['product_num'] = $product_num;
- $data['type'] = 1;
- if ($create_uid > 0) {
- $data['create_uid'] = $create_uid;
- }
- Dever::db('code/info')->insert($data);
- return $code;
- }
- }
|