<?php
/**
 * @copyright   2008-2020 伯乐发卡 <http://www.lailiyun.com>
 * @creatdate   2020-9-10 Mr wang <634273662@qq.com>
 * @version   伯乐发卡V3（个人自动发卡系统）
 */

namespace BL\app\model;

use BL\app\libs\Model;

class KamiModel
{
    function __construct()
    {
        $this->model = new Model();
    }

    /**库存操作
     * @param $knum
     * @param $num
     * @param string $ck
     * @return bool|mixed
     */
    public function kuc($gid,$knum,$num,$ck = '+')
    {
        if($ck == "+"){
            $kuc = $knum+$num;
        }else{
            $kuc = $knum-$num;
        }
        $data['kuc'] = $kuc;
        $res = $this->model->from('goods')->updateSet($data)->where(array('fields' => 'id=?', 'values' => array($gid)))->update();
        return $res;
    }
}