|
@@ -17,6 +17,27 @@ class Qc extends Base {
|
|
|
|
|
|
|
|
|
|
|
|
+
|
|
|
+ public function setNewSerial()
|
|
|
+ {
|
|
|
+ $goods_id = 17;
|
|
|
+ $source = 3;
|
|
|
+ $sql = "UPDATE goods_collect d,( SELECT id, @num := @num + 1 AS ROW FROM goods_collect,( SELECT @num := 0 ) a
|
|
|
+ WHERE goods_id = {$goods_id} AND source = {$source} ) c SET d.serial = c.ROW WHERE d.goods_id = {$goods_id} AND d.id = c.id AND d.source = {$source} ";
|
|
|
+ Db::execute($sql);
|
|
|
+ $list = Db::table('goods_collect')
|
|
|
+ ->field('id,original_id,from_id')
|
|
|
+ ->where(['goods_id'=>$goods_id,'source'=>4])
|
|
|
+ ->order('id asc')
|
|
|
+ ->select();
|
|
|
+ foreach ($list as $v) {
|
|
|
+ $original_serial = Db::table('goods_collect')->where('id',$v['original_id'])->value('serial');
|
|
|
+ Db::table('goods_collect')->where('id',$v['id'])->update(['serial'=>$original_serial]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
public function setHash()
|
|
|
{
|
|
|
$list = Db::table('goods_collect')
|