|
@@ -78,7 +78,13 @@ func GetCygxArticleCollectList(condition string) (items []*CygxArticleCollect, e
|
|
|
//修改用户收藏文章的相关信息
|
|
|
func UpdateCygxArticleCollect(wxUser *WxUserItem) (err error) {
|
|
|
o := orm.NewOrm()
|
|
|
- sql := `UPDATE cygx_article_collect SET email=?,company_id=?,company_name=?,mobile=?,real_name=? WHERE user_id=? `
|
|
|
- _, err = o.Raw(sql, wxUser.Email, wxUser.CompanyId, wxUser.CompanyName, wxUser.Mobile, wxUser.RealName, wxUser.UserId).Exec()
|
|
|
+ var sql string
|
|
|
+ if wxUser.Mobile != "" {
|
|
|
+ sql = `UPDATE cygx_article_collect SET email=?,company_id=?,company_name=?,user_id=?,real_name=? WHERE mobile=? `
|
|
|
+ _, err = o.Raw(sql, wxUser.Email, wxUser.CompanyId, wxUser.CompanyName, wxUser.UserId, wxUser.RealName, wxUser.Mobile).Exec()
|
|
|
+ } else if wxUser.Email != "" {
|
|
|
+ sql = `UPDATE cygx_article_collect SET user_id=?,company_id=?,company_name=?,mobile=?,real_name=? WHERE email=? `
|
|
|
+ _, err = o.Raw(sql, wxUser.UserId, wxUser.CompanyId, wxUser.CompanyName, wxUser.Mobile, wxUser.RealName, wxUser.Email).Exec()
|
|
|
+ }
|
|
|
return
|
|
|
}
|