update($update);
}
}
/**
* 更新需求属性信息
*
* @return mixed
*/
public function attrUpdate($id, $name, $data)
{
print_r($data);die;
foreach ($data as $k => $v) {
}
}
/**
* 显示信息
*
* @return mixed
*/
public function info($id)
{
$info = Dever::db('goods/info')->one($id);
if ($info) {
$table['编号'] = $info['id'];
$table['标题'] = $info['name'];
$table['分类'] = Dever::load("category/api.string", $info['category']);
if ($info['pic_cover']) {
$table['封面图'] = '';
}
if ($info['shop_id'] > 0) {
$shop = Dever::load('goods/shop-one', $info['shop_id']);
$table['所属店铺'] = $shop['name'];
}
if ($info['brand_id'] > 0) {
$brand = Dever::load('goods/brand-one', $info['brand_id']);
$table['所属品牌'] = $brand['name'];
}
//$table['属性'] = $this->attrInfo($info);
if ($info['cdate']) {
$table['发布时间'] = date("Y-m-d H:i:s", $info['cdate']);
}
}
return Dever::table($table);
}
private function attrInfo($info)
{
$table = array();
$info = Info::init($info['top_category_id']);
if ($info) {
$info = $info->info($info, 'id');
if ($info && isset($info['attr'])) {
foreach ($info['attr'] as $k => $v) {
$table[$v['name']] = $v['value_string'];
}
}
}
return Dever::table($table);
}
public function area($id, $name, $data)
{
# 不再执行syncone等后续操作
Dever::config('base')->after = 1;
$type = Dever::input('type');
$area = Dever::param('area', $data);
if ($area) {
if (isset($area[2])) {
$update['district_id'] = $area[2];
}
if (isset($area[1])) {
$update['city_id'] = $area[1];
}
if (isset($area[0])) {
$update['province_id'] = $area[0];
}
if (isset($update)) {
$update['where_id'] = $id;
Dever::db($type . '/info')->update($update);
}
}
}
public function skuInput()
{
$id = Dever::input('search_option_info_id');
$info = Dever::db('goods/info')->one($id);
$info = Info::init(-1)->info($info, 'list_reorder');
if ($info['attr']) {
$head = '
';
$body = '