|
@@ -4,7 +4,7 @@ import (
|
|
|
"box-cost/db/repo"
|
|
|
|
|
|
"github.com/gin-gonic/gin"
|
|
|
- "go.mongodb.org/mongo-driver/bson"
|
|
|
+ "go.mongodb.org/mongo-driver/bson/primitive"
|
|
|
)
|
|
|
|
|
|
// func UpdateIsAckStatus(c *gin.Context, apictx *ApiSession) (interface{}, error) {
|
|
@@ -68,57 +68,26 @@ import (
|
|
|
// }
|
|
|
|
|
|
func Printr(c *gin.Context, apictx *ApiSession) (interface{}, error) {
|
|
|
- // 2023粽子礼盒稻香拾味定制款彩盒手提绳
|
|
|
- // bill := model.ProductBill{}
|
|
|
- // bill.Remark = ""
|
|
|
- // fmt.Println(bill)
|
|
|
- // !数据库报错,不能识别remark == ""
|
|
|
- // !无效
|
|
|
- // return repo.RepoUpdateSetDoc(apictx.CreateRepoCtx(), repo.CollectionBillProduct, "6440dc82afe88127dda4a5ef", &model.ProductBill{Remark: ""})
|
|
|
- // !有效
|
|
|
- return repo.RepoUpdateSetDoc(apictx.CreateRepoCtx(), repo.CollectionBillProduct, "6440dc82afe88127dda4a5ef", bson.M{"remark": ""})
|
|
|
+ // !如果数据模型tag omitempty存在 对某个字段设置零值的方法
|
|
|
+ // !如果有omitempty存在,对应字段零值将被忽略
|
|
|
+ // !该字段设置为引用类型
|
|
|
+ // !创建该字段时设置默认值
|
|
|
+ type RegCode struct {
|
|
|
+ Id primitive.ObjectID `bson:"_id,omitempty" json:"_id"`
|
|
|
+ Roles *[]string `bson:"roles,omitempty" json:"roles"`
|
|
|
+ Key string `bson:"key,omitempty" json:"key"`
|
|
|
+ }
|
|
|
+ roles := []string{}
|
|
|
|
|
|
-}
|
|
|
+ // ?接收客户端传参数,更新
|
|
|
+ // {"_id":"642e2e97243b5c5107d70204","roles":false}
|
|
|
+ // form := RegCode{}
|
|
|
+ // err := c.ShouldBindJSON(&form)
|
|
|
+ // if err != nil {
|
|
|
+ // return nil, err
|
|
|
+ // }
|
|
|
|
|
|
-// ? 测试供应商备注
|
|
|
-// {{boxcost}}/bill/produce/download?id=6444d14db2a7c8eae4240579
|
|
|
+ // return repo.RepoUpdateSetDoc(apictx.CreateRepoCtx(), "reg-code", form.Id.Hex(), &RegCode{Roles: form.Roles})
|
|
|
+ return repo.RepoUpdateSetDoc(apictx.CreateRepoCtx(), "reg-code", "642e2e97243b5c5107d70204", &RegCode{Roles: &roles})
|
|
|
|
|
|
-// {
|
|
|
-// "_id": ObjectId("6440dc82afe88127dda4a5ef"),
|
|
|
-// "packId": ObjectId("643f9bdd75db8728bf88c0da"),
|
|
|
-// "planId": ObjectId("643fae2175db8728bf88c0e7"),
|
|
|
-// "supplierId": ObjectId("63f3167b1031634bc6eeb8be"),
|
|
|
-// "userId": ObjectId("63e208dc7452ab74932b9e37"),
|
|
|
-// "userName": "郑茜",
|
|
|
-// "type": "成品采购",
|
|
|
-// "status": "complete",
|
|
|
-// "reviewed": NumberInt("1"),
|
|
|
-// "createTime": ISODate("2023-04-20T06:32:34.18Z"),
|
|
|
-// "updateTime": ISODate("2023-04-24T06:05:42.177Z"),
|
|
|
-// "supplier": "029-温州意彩织带有限公司",
|
|
|
-// "sendTo": "新都军屯镇食品大道158号稻香村--联系电话巫元萍13808077671",
|
|
|
-// "productName": "稻香拾味定制款手提盒(5000套)--墨绿色罗纹丝带",
|
|
|
-// "products": [
|
|
|
-// {
|
|
|
-// "id": "16819724424006440d278afe88127dda4a5e6",
|
|
|
-// "name": "墨绿色罗纹丝带",
|
|
|
-// "norm": "2cm*45cm",
|
|
|
-// "orderCount": NumberInt("5100"),
|
|
|
-// "orderPrice": 0.09,
|
|
|
-// "remark": "2023粽子礼盒稻香拾味定制款彩盒手提绳",
|
|
|
-// "deliveryTime": ISODate("2023-04-24T06:35:08.000Z"),
|
|
|
-// "confirmCount": NumberInt("5100"),
|
|
|
-// "unit": "元/对"
|
|
|
-// }
|
|
|
-// ],
|
|
|
-// "serialNumber": "CPCG-000022",
|
|
|
-// "remark": "2023粽子礼盒稻香拾味定制款彩盒手提绳",
|
|
|
-// "isAck": false,
|
|
|
-// "signUsers": [
|
|
|
-// ObjectId("63e209a87452ab74932b9e38")
|
|
|
-// ],
|
|
|
-// "isSend": true,
|
|
|
-// "sendTime": ISODate("2023-04-20T06:47:00.685Z"),
|
|
|
-// "supplierRemark": " ",
|
|
|
-// "completeTime": ISODate("2023-04-24T06:05:42.176Z")
|
|
|
-// }
|
|
|
+}
|